1 # Test reading debug information from in object files.
3 if { [skip_hp_tests
] } { continue }
5 if { ![istarget
"hppa*-*-hpux*"] } {
6 verbose
"HPUX test ignored for non-hppa targets."
11 set srcsubdir $
{srcdir
}/$
{subdir
}/objdbg03
12 set objdbgdir $
{objdir
}/$
{subdir
}/objdbg03
13 set binfile $
{objdbgdir
}/$
{testfile
}
14 set toolssubdir $
{srcdir
}/$
{subdir
}/tools
15 if [istarget
"hppa64-*-*"] {
16 set symaddrfile $
{toolssubdir
}/symaddr.pa64
18 set symaddrfile $
{toolssubdir
}/symaddr
21 # Create and source the file that provides information about the compiler
22 # used to
compile the test case.
23 if [get_compiler_info $
{binfile
}] {
27 if {!$hp_aCC_compiler
&& !$hp_cc_compiler
} {
31 if { [gdb_compile
"${toolssubdir}/test-objdbg.cc" "${objdbgdir}/test-objdbg.o" object "debug c++ {additional_flags=-I${toolssubdir} +objdebug}"] != "" } {
32 gdb_suppress_entire_file
"WARNING: +objdebug option is not supported in this compiler version, test ignored."
35 if { [gdb_compile
"${srcsubdir}/x1.cc" "${objdbgdir}/x1.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
36 perror
"Couldn't compile x1.cc"
40 if { [gdb_compile
"${srcsubdir}/x2.cc" "${objdbgdir}/x2.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
41 perror
"Couldn't compile x2.cc"
45 if { [gdb_compile
"${srcsubdir}/x3.cc" "${objdbgdir}/x3.o" object "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
46 perror
"Couldn't compile x3.cc"
50 if { [gdb_compile
"${objdbgdir}/x1.o ${objdbgdir}/x2.o ${objdbgdir}/x3.o" "${binfile}" executable "debug c++ {additional_flags=-I${srcsubdir} +objdebug}"] != "" } {
51 perror
"Couldn't compile ${binfile}"
56 # Test some
normal commons
63 gdb_reinitialize_dir $
{srcsubdir
}
66 gdb_test
"ptype common1" "type = int"
67 gdb_test
"ptype common2" "type = int"
68 gdb_test
"ptype common3" "type = int"
69 gdb_test
"ptype data1" "type = int"
70 gdb_test
"ptype data2" "type = int"
71 gdb_test
"ptype data3" "type = int"
72 gdb_test
"ptype common11" "type = int"
73 gdb_test
"ptype common10" "type = int"
74 gdb_test
"ptype data10" "type = int"
75 gdb_test
"ptype data11" "type = int"
81 gdb_reinitialize_dir $
{srcsubdir
}
84 gdb_test
"b main" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file ..*/x1.cc, line 11."
85 gdb_test
"run" "Starting program:.*Breakpoint \[0-9\]+, main .*/x1.cc:11.*"
86 gdb_test
"p data1" "..* = 1"
87 gdb_test
"p data2" "..* = 2"
88 gdb_test
"p data3" "..* = 3"
89 gdb_test
"p data10" "..* = 10"
90 gdb_test
"p data11" "..* = 11"
92 gdb_test
"p common11" "..* = 11"
94 gdb_test
"s 1" "foo .*/x3.cc:15.*"
95 gdb_test
"s 4" ".*20.*"
96 gdb_test
"p data4" "..* = 4"
97 gdb_test
"p common4" "..* = 4"
100 gdb_test
"n" "main .*/x1.cc:14.*"
101 gdb_test
"p common1" "..* = 1"
102 gdb_test
"p common2" "..* = 2"
103 gdb_test
"p common3" "..* = 3"
105 # Verify that addresses match those in the executable
109 gdb_reinitialize_dir $
{srcsubdir
}
112 set exec_output_data1
[lindex
[remote_exec build
"${symaddrfile} ${binfile} data1"] 1]
113 regsub
-all
"\[\r\n\]" ${exec_output_data1} "" exec_output_data1
115 set exec_output_data2
[lindex
[remote_exec build
"${symaddrfile} ${binfile} data2"] 1]
116 regsub
-all
"\[\r\n\]" ${exec_output_data2} "" exec_output_data2
118 set exec_output_data3
[lindex
[remote_exec build
"${symaddrfile} ${binfile} data3"] 1]
119 regsub
-all
"\[\r\n\]" ${exec_output_data3} "" exec_output_data3
121 set exec_output_data10
[lindex
[remote_exec build
"${symaddrfile} ${binfile} data10"] 1]
122 regsub
-all
"\[\r\n\]" ${exec_output_data10} "" exec_output_data10
124 set exec_output_data11
[lindex
[remote_exec build
"${symaddrfile} ${binfile} data11"] 1]
125 regsub
-all
"\[\r\n\]" ${exec_output_data11} "" exec_output_data11
127 set exec_output_common1
[lindex
[remote_exec build
"${symaddrfile} ${binfile} common1"] 1]
128 regsub
-all
"\[\r\n\]" ${exec_output_common1} "" exec_output_common1
130 set exec_output_common2
[lindex
[remote_exec build
"${symaddrfile} ${binfile} common2"] 1]
131 regsub
-all
"\[\r\n\]" ${exec_output_common2} "" exec_output_common2
133 set exec_output_common3
[lindex
[remote_exec build
"${symaddrfile} ${binfile} common3"] 1]
134 regsub
-all
"\[\r\n\]" ${exec_output_common3} "" exec_output_common3
136 set exec_output_common10
[lindex
[remote_exec build
"${symaddrfile} ${binfile} common10"] 1]
137 regsub
-all
"\[\r\n\]" ${exec_output_common10} "" exec_output_common10
139 set exec_output_common11
[lindex
[remote_exec build
"${symaddrfile} ${binfile} common11"] 1]
140 regsub
-all
"\[\r\n\]" ${exec_output_common11} "" exec_output_common11
142 if [istarget
"hppa64-*-*"] {
143 gdb_test
"p &data1" "..* = \\(int \[*\]\\) ${exec_output_data1}"
144 gdb_test
"p &data2" "..* = \\(int \[*\]\\) ${exec_output_data2}"
145 gdb_test
"p &data3" "..* = \\(int \[*\]\\) ${exec_output_data3}"
146 gdb_test
"p &data10" "..* = \\(int \[*\]\\) ${exec_output_data10}"
147 gdb_test
"p &data11" "..* = \\(int \[*\]\\) ${exec_output_data11}"
148 gdb_test
"p &common1" "..* = \\(int \[*\]\\) ${exec_output_common1}"
149 gdb_test
"p &common2" "..* = \\(int \[*\]\\) ${exec_output_common2}"
150 gdb_test
"p &common3" "..* = \\(int \[*\]\\) ${exec_output_common3}"
151 gdb_test
"p &common10" "..* = \\(int \[*\]\\) ${exec_output_common10}"
152 gdb_test
"p &common11" "..* = \\(int \[*\]\\) ${exec_output_common11}"
154 gdb_test
"p &data1" "..* = \\(int \[*\]\\) 0x${exec_output_data1}"
155 gdb_test
"p &data2" "..* = \\(int \[*\]\\) 0x${exec_output_data2}"
156 gdb_test
"p &data3" "..* = \\(int \[*\]\\) 0x${exec_output_data3}"
157 gdb_test
"p &data10" "..* = \\(int \[*\]\\) 0x${exec_output_data10}"
158 gdb_test
"p &data11" "..* = \\(int \[*\]\\) 0x${exec_output_data11}"
159 gdb_test
"p &common1" "..* = \\(int \[*\]\\) 0x${exec_output_common1}"
160 gdb_test
"p &common2" "..* = \\(int \[*\]\\) 0x${exec_output_common2}"
161 gdb_test
"p &common3" "..* = \\(int \[*\]\\) 0x${exec_output_common3}"
162 gdb_test
"p &common10" "..* = \\(int \[*\]\\) 0x${exec_output_common10}"
163 gdb_test
"p &common11" "..* = \\(int \[*\]\\) 0x${exec_output_common11}"