* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.objdbg / objdbg03.exp
CommitLineData
7be570e7
JM
1# Test reading debug information from in object files.
2
3if { [skip_hp_tests] } { continue }
4
5if { ![istarget "hppa*-*-hpux*"] } {
6 verbose "HPUX test ignored for non-hppa targets."
7 return 0
8}
9
10set testfile "test"
11set srcsubdir ${srcdir}/${subdir}/objdbg03
12set objdbgdir ${objdir}/${subdir}/objdbg03
13set binfile ${objdbgdir}/${testfile}
14set toolssubdir ${srcdir}/${subdir}/tools
ca344dff 15if [istarget "hppa64-*-*"] {
7be570e7
JM
16 set symaddrfile ${toolssubdir}/symaddr.pa64
17} else {
18 set symaddrfile ${toolssubdir}/symaddr
19}
20
afabe08c
JL
21# Create and source the file that provides information about the compiler
22# used to compile the test case.
23if [get_compiler_info ${binfile}] {
24 return -1
25}
26
27if {!$hp_aCC_compiler && !$hp_cc_compiler} {
28 return 0
29}
30
7be570e7 31if { [gdb_compile "${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
b60f0898
JB
32 untested objdbg03.exp
33 return -1
7be570e7
JM
34}
35
36if { [gdb_compile "${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
37 perror "Couldn't compile x1.cc"
38 return -1
39}
40
41if { [gdb_compile "${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
42 perror "Couldn't compile x2.cc"
43 return -1
44}
45
46if { [gdb_compile "${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
47 perror "Couldn't compile x3.cc"
48 return -1
49}
50
51if { [gdb_compile "${objdbgdir}/x1.o ${objdbgdir}/x2.o ${objdbgdir}/x3.o" "${binfile}" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
52 perror "Couldn't compile ${binfile}"
53 return -1
54}
55
56#
57# Test some normal commons
58#
59
60# Print the types
61
62gdb_exit
63gdb_start
64gdb_reinitialize_dir ${srcsubdir}
65gdb_load ${binfile}
66
67gdb_test "ptype common1" "type = int"
68gdb_test "ptype common2" "type = int"
69gdb_test "ptype common3" "type = int"
70gdb_test "ptype data1" "type = int"
71gdb_test "ptype data2" "type = int"
72gdb_test "ptype data3" "type = int"
73gdb_test "ptype common11" "type = int"
74gdb_test "ptype common10" "type = int"
75gdb_test "ptype data10" "type = int"
76gdb_test "ptype data11" "type = int"
77
78# Print the values
79
80gdb_exit
81gdb_start
82gdb_reinitialize_dir ${srcsubdir}
83gdb_load ${binfile}
84
85gdb_test "b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 11."
86gdb_test "run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:11.*"
87gdb_test "p data1" "..* = 1"
88gdb_test "p data2" "..* = 2"
89gdb_test "p data3" "..* = 3"
90gdb_test "p data10" "..* = 10"
91gdb_test "p data11" "..* = 11"
92gdb_test "n" ".*12.*"
93gdb_test "p common11" "..* = 11"
94
95gdb_test "s 1" "foo .*/x3.cc:15.*"
96gdb_test "s 4" ".*20.*"
97gdb_test "p data4" "..* = 4"
98gdb_test "p common4" "..* = 4"
99gdb_test "n" ".*21.*"
100
101gdb_test "n" "main .*/x1.cc:14.*"
102gdb_test "p common1" "..* = 1"
103gdb_test "p common2" "..* = 2"
104gdb_test "p common3" "..* = 3"
105
106# Verify that addresses match those in the executable
107
108gdb_exit
109gdb_start
110gdb_reinitialize_dir ${srcsubdir}
111gdb_load ${binfile}
112
113set exec_output_data1 [lindex [remote_exec build "${symaddrfile} ${binfile} data1"] 1]
114regsub -all "\[\r\n\]" ${exec_output_data1} "" exec_output_data1
115
116set exec_output_data2 [lindex [remote_exec build "${symaddrfile} ${binfile} data2"] 1]
117regsub -all "\[\r\n\]" ${exec_output_data2} "" exec_output_data2
118
119set exec_output_data3 [lindex [remote_exec build "${symaddrfile} ${binfile} data3"] 1]
120regsub -all "\[\r\n\]" ${exec_output_data3} "" exec_output_data3
121
122set exec_output_data10 [lindex [remote_exec build "${symaddrfile} ${binfile} data10"] 1]
123regsub -all "\[\r\n\]" ${exec_output_data10} "" exec_output_data10
124
125set exec_output_data11 [lindex [remote_exec build "${symaddrfile} ${binfile} data11"] 1]
126regsub -all "\[\r\n\]" ${exec_output_data11} "" exec_output_data11
127
128set exec_output_common1 [lindex [remote_exec build "${symaddrfile} ${binfile} common1"] 1]
129regsub -all "\[\r\n\]" ${exec_output_common1} "" exec_output_common1
130
131set exec_output_common2 [lindex [remote_exec build "${symaddrfile} ${binfile} common2"] 1]
132regsub -all "\[\r\n\]" ${exec_output_common2} "" exec_output_common2
133
134set exec_output_common3 [lindex [remote_exec build "${symaddrfile} ${binfile} common3"] 1]
135regsub -all "\[\r\n\]" ${exec_output_common3} "" exec_output_common3
136
137set exec_output_common10 [lindex [remote_exec build "${symaddrfile} ${binfile} common10"] 1]
138regsub -all "\[\r\n\]" ${exec_output_common10} "" exec_output_common10
139
140set exec_output_common11 [lindex [remote_exec build "${symaddrfile} ${binfile} common11"] 1]
141regsub -all "\[\r\n\]" ${exec_output_common11} "" exec_output_common11
142
ca344dff 143if [istarget "hppa64-*-*"] {
7be570e7
JM
144 gdb_test "p &data1" "..* = \\(int \[*\]\\) ${exec_output_data1}"
145 gdb_test "p &data2" "..* = \\(int \[*\]\\) ${exec_output_data2}"
146 gdb_test "p &data3" "..* = \\(int \[*\]\\) ${exec_output_data3}"
147 gdb_test "p &data10" "..* = \\(int \[*\]\\) ${exec_output_data10}"
148 gdb_test "p &data11" "..* = \\(int \[*\]\\) ${exec_output_data11}"
149 gdb_test "p &common1" "..* = \\(int \[*\]\\) ${exec_output_common1}"
150 gdb_test "p &common2" "..* = \\(int \[*\]\\) ${exec_output_common2}"
151 gdb_test "p &common3" "..* = \\(int \[*\]\\) ${exec_output_common3}"
152 gdb_test "p &common10" "..* = \\(int \[*\]\\) ${exec_output_common10}"
153 gdb_test "p &common11" "..* = \\(int \[*\]\\) ${exec_output_common11}"
154} else {
155 gdb_test "p &data1" "..* = \\(int \[*\]\\) 0x${exec_output_data1}"
156 gdb_test "p &data2" "..* = \\(int \[*\]\\) 0x${exec_output_data2}"
157 gdb_test "p &data3" "..* = \\(int \[*\]\\) 0x${exec_output_data3}"
158 gdb_test "p &data10" "..* = \\(int \[*\]\\) 0x${exec_output_data10}"
159 gdb_test "p &data11" "..* = \\(int \[*\]\\) 0x${exec_output_data11}"
160 gdb_test "p &common1" "..* = \\(int \[*\]\\) 0x${exec_output_common1}"
161 gdb_test "p &common2" "..* = \\(int \[*\]\\) 0x${exec_output_common2}"
162 gdb_test "p &common3" "..* = \\(int \[*\]\\) 0x${exec_output_common3}"
163 gdb_test "p &common10" "..* = \\(int \[*\]\\) 0x${exec_output_common10}"
164 gdb_test "p &common11" "..* = \\(int \[*\]\\) 0x${exec_output_common11}"
165}
This page took 0.630749 seconds and 4 git commands to generate.