OLD | NEW |
1 # Copyright 2010-2012 Free Software Foundation, Inc. | 1 # Copyright 2010-2013 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This test only works on GNU/Linux. | 16 # This test only works on GNU/Linux. |
17 if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] | 17 if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub] |
18 || ![istarget *-linux*] || [skip_shlib_tests]} { | 18 || ![istarget *-linux*] || [skip_shlib_tests]} { |
19 continue | 19 continue |
20 } | 20 } |
21 | 21 |
22 load_lib prelink-support.exp | 22 load_lib prelink-support.exp |
23 | 23 |
24 set test "break-interp" | 24 set test "break-interp" |
25 set binprefix ${objdir}/${subdir}/${test} | 25 set binprefix [standard_output_file ${test}] |
26 # Only to get the $interp_system name. | 26 # Only to get the $interp_system name. |
27 set srcfile_test "start.c" | 27 set srcfile_test "start.c" |
28 set binfile_test ${test}-test | 28 set binfile_test ${test}-test |
29 set binfile_lib ${objdir}/${subdir}/${test}.so | 29 set binfile_lib ${binprefix}.so |
30 set srcfile "${test}-main.c" | 30 set srcfile "${test}-main.c" |
31 set srcfile_lib "${test}-lib.c" | 31 set srcfile_lib "${test}-lib.c" |
32 | 32 |
33 if [get_compiler_info] { | 33 if [get_compiler_info] { |
34 return -1 | 34 return -1 |
35 } | 35 } |
36 | 36 |
37 # Use -soname so that the new library gets copied by build_executable_own_libs. | 37 # Use -soname so that the new library gets copied by build_executable_own_libs. |
38 | 38 |
39 if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list d
ebug ldflags=-Wl,-soname,${test}.so]] != ""} { | 39 if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list d
ebug ldflags=-Wl,-soname,${test}.so]] != ""} { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 gdb_exit | 76 gdb_exit |
77 gdb_start | 77 gdb_start |
78 set debug_root "" | 78 set debug_root "" |
79 set test "show debug-file-directory" | 79 set test "show debug-file-directory" |
80 gdb_test_multiple $test $test { | 80 gdb_test_multiple $test $test { |
81 -re "The directory where separate debug symbols are searched for is \"(.*)\"
.\r\n$gdb_prompt $" { | 81 -re "The directory where separate debug symbols are searched for is \"(.*)\"
.\r\n$gdb_prompt $" { |
82 set debug_root $expect_out(1,string) | 82 set debug_root $expect_out(1,string) |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp] | 86 set interp_system [section_get [standard_output_file $binfile_test] .interp] |
87 set interp_system_debug [system_debug_get $interp_system] | 87 set interp_system_debug [system_debug_get $interp_system] |
88 verbose -log "$interp_system has debug $interp_system_debug" | 88 verbose -log "$interp_system has debug $interp_system_debug" |
89 | 89 |
90 proc prelinkNO {arg {name ""}} { | 90 proc prelinkNO {arg {name ""}} { |
91 return [prelink_no $arg $name] | 91 return [prelink_no $arg $name] |
92 } | 92 } |
93 | 93 |
94 proc prelinkYES {arg {name ""}} { | 94 proc prelinkYES {arg {name ""}} { |
95 return [prelink_yes $arg $name] | 95 return [prelink_yes $arg $name] |
96 } | 96 } |
97 | 97 |
98 proc strip_debug {dest} { | 98 proc strip_debug {dest} { |
99 set test "strip [file tail $dest]" | 99 set test "strip [file tail $dest]" |
100 set strip_program [transform strip] | 100 set strip_program [transform strip] |
101 set command "exec $strip_program --strip-debug $dest" | 101 set command "exec $strip_program --strip-debug $dest" |
102 verbose -log "command is $command" | 102 verbose -log "command is $command" |
103 if [catch $command] { | 103 if [catch $command] { |
104 fail $test | 104 fail $test |
105 return 0 | 105 return 0 |
106 } else { | 106 } else { |
107 pass $test | 107 pass $test |
108 return 1 | 108 return 1 |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
| 112 # The marker function for the standard runtime linker interface is |
| 113 # _dl_debug_state. The probes-based interface has no specific marker |
| 114 # function; the probe we will stop on (init_start) is in dl_main so we |
| 115 # check for that. |
| 116 |
| 117 set solib_bp {(_dl_debug_state|dl_main)} |
| 118 |
112 # Implementation of reach. | 119 # Implementation of reach. |
113 | 120 |
114 proc reach_1 {func command displacement} { | 121 proc reach_1 {func command displacement} { |
115 global gdb_prompt expect_out | 122 global gdb_prompt expect_out solib_bp |
116 | 123 |
117 if {$func == "_dl_debug_state"} { | 124 if {$func == $solib_bp} { |
118 # Breakpoint on _dl_debug_state can have problems due to its overlap | 125 # Breakpoint on _dl_debug_state can have problems due to its overlap |
119 # with the existing internal breakpoint from GDB. | 126 # with the existing internal breakpoint from GDB. |
120 gdb_test_no_output "set stop-on-solib-events 1" | 127 gdb_test_no_output "set stop-on-solib-events 1" |
121 } elseif {! [gdb_breakpoint $func allow-pending]} { | 128 } elseif {! [gdb_breakpoint $func allow-pending]} { |
122 return | 129 return |
123 } | 130 } |
124 | 131 |
125 set test "reach" | 132 set test "reach" |
126 set test_displacement "seen displacement message as $displacement" | 133 set test_displacement "seen displacement message as $displacement" |
127 set debug_state_count 0 | 134 set debug_state_count 0 |
128 gdb_test_multiple $command $test { | 135 gdb_test_multiple $command $test { |
129 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0
-9a-f\]+) " { | 136 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0
-9a-f\]+) " { |
130 # Missing "$gdb_prompt $" is intentional. | 137 # Missing "$gdb_prompt $" is intentional. |
131 if {$expect_out(1,string) == "0x0"} { | 138 if {$expect_out(1,string) == "0x0"} { |
132 set case "ZERO" | 139 set case "ZERO" |
133 } else { | 140 } else { |
134 set case "NONZERO" | 141 set case "NONZERO" |
135 } | 142 } |
136 if {$displacement == $case || $displacement == "PRESENT"} { | 143 if {$displacement == $case || $displacement == "PRESENT"} { |
137 pass $test_displacement | 144 pass $test_displacement |
138 set displacement "FOUND-$displacement" | 145 set displacement "FOUND-$displacement" |
139 } else { | 146 } else { |
140 fail $test_displacement | 147 fail $test_displacement |
141 } | 148 } |
142 exp_continue | 149 exp_continue |
143 } | 150 } |
144 -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.
*$gdb_prompt $" { | 151 -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.
*$gdb_prompt $" { |
145 » if {$func == "_dl_debug_state"} { | 152 » if {$func == $solib_bp} { |
146 fail $test | 153 fail $test |
147 } else { | 154 } else { |
148 pass $test | 155 pass $test |
149 } | 156 } |
150 } | 157 } |
151 -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n
$gdb_prompt $" { | 158 -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n
$gdb_prompt $" { |
152 » if {$func == "_dl_debug_state"} { | 159 » if {$func == $solib_bp} { |
153 fail $test | 160 fail $test |
154 } else { | 161 } else { |
155 pass $test | 162 pass $test |
156 } | 163 } |
157 } | 164 } |
158 -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $"
{ | 165 -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $"
{ |
159 » if {$func == "_dl_debug_state"} { | 166 » if {$func == $solib_bp} { |
160 if {$debug_state_count == 0} { | 167 if {$debug_state_count == 0} { |
161 # First stop does not yet relocate the _start function | 168 # First stop does not yet relocate the _start function |
162 # descriptor on ppc64. | 169 # descriptor on ppc64. |
163 set debug_state_count 1 | 170 set debug_state_count 1 |
164 send_gdb "continue\n" | 171 send_gdb "continue\n" |
165 exp_continue | 172 exp_continue |
166 } else { | 173 } else { |
167 pass $test | 174 pass $test |
168 } | 175 } |
169 } else { | 176 } else { |
170 fail $test | 177 fail $test |
171 } | 178 } |
172 } | 179 } |
173 } | 180 } |
174 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { | 181 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { |
175 fail $test_displacement | 182 fail $test_displacement |
176 } | 183 } |
177 | 184 |
178 if {$func == "_dl_debug_state"} { | 185 if {$func == $solib_bp} { |
179 gdb_test_no_output "set stop-on-solib-events 0" | 186 gdb_test_no_output "set stop-on-solib-events 0" |
180 } | 187 } |
181 } | 188 } |
182 | 189 |
183 # `runto' does not check we stopped really at the function we specified. | 190 # `runto' does not check we stopped really at the function we specified. |
184 # DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for | 191 # DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for |
185 # displacement of 0 bytes to be present, "NONZERO" for displacement of non-0 | 192 # displacement of 0 bytes to be present, "NONZERO" for displacement of non-0 |
186 # bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid. | 193 # bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid. |
187 proc reach {func command displacement} { | 194 proc reach {func command displacement} { |
188 with_test_prefix "reach-$func" { | 195 with_test_prefix "reach-$func" { |
189 reach_1 $func $command $displacement | 196 reach_1 $func $command $displacement |
190 } | 197 } |
191 } | 198 } |
192 | 199 |
193 proc test_core {file displacement} { with_test_prefix "core" { | 200 proc test_core {file displacement} { |
194 global srcdir subdir gdb_prompt expect_out | 201 with_test_prefix "core" { |
| 202 » global srcdir subdir gdb_prompt expect_out |
195 | 203 |
196 set corefile [core_find $file {} "segv"] | 204 » set corefile [core_find $file {} "segv"] |
197 if {$corefile == ""} { | 205 » if {$corefile == ""} { |
198 » return | 206 » return |
| 207 » } |
| 208 |
| 209 » gdb_exit |
| 210 » gdb_start |
| 211 » # Clear it to never find any separate debug infos in $debug_root. |
| 212 » gdb_test_no_output "set debug-file-directory" \ |
| 213 » "set debug-file-directory for core" |
| 214 » gdb_reinitialize_dir $srcdir/$subdir |
| 215 » gdb_load $file |
| 216 |
| 217 » # Print the "PIE (Position Independent Executable) displacement" message
. |
| 218 » gdb_test_no_output "set verbose on" |
| 219 |
| 220 » set test "core loaded" |
| 221 » set test_displacement "seen displacement message as $displacement" |
| 222 » gdb_test_multiple "core-file $corefile" $test { |
| 223 » -re "Using PIE \\(Position Independent Executable\\) displacement (0
x\[0-9a-f\]+) " { |
| 224 » » # Missing "$gdb_prompt $" is intentional. |
| 225 » » if {$expect_out(1,string) == "0x0"} { |
| 226 » » set case "ZERO" |
| 227 » » } else { |
| 228 » » set case "NONZERO" |
| 229 » » } |
| 230 » » if {$displacement == $case || $displacement == "PRESENT"} { |
| 231 » » pass $test_displacement |
| 232 » » set displacement "FOUND-$displacement" |
| 233 » » } else { |
| 234 » » fail $test_displacement |
| 235 » » } |
| 236 » » exp_continue |
| 237 » } |
| 238 » -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" { |
| 239 » » # Do not check the binary filename as it may be truncated. |
| 240 » » pass $test |
| 241 » } |
| 242 » } |
| 243 » if ![regexp {^(NONE|FOUND-.*)$} $displacement] { |
| 244 » fail $test_displacement |
| 245 » } |
| 246 |
| 247 » gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+
+\[^\r\n\]*\\mmain\\M.*" "core main bt" |
199 } | 248 } |
| 249 } |
200 | 250 |
201 gdb_exit | 251 proc test_attach_gdb {file pid displacement prefix} { |
202 gdb_start | 252 with_test_prefix "$prefix" { |
203 # Clear it to never find any separate debug infos in $debug_root. | 253 » global gdb_prompt expect_out |
204 gdb_test_no_output "set debug-file-directory" \ | |
205 » "set debug-file-directory for core" | |
206 gdb_reinitialize_dir $srcdir/$subdir | |
207 gdb_load $file | |
208 | 254 |
209 # Print the "PIE (Position Independent Executable) displacement" message. | 255 » gdb_exit |
210 gdb_test_no_output "set verbose on" | 256 » gdb_start |
211 | 257 |
212 set test "core loaded" | 258 » # Print the "PIE (Position Independent Executable) displacement" message
. |
213 set test_displacement "seen displacement message as $displacement" | 259 » gdb_test_no_output "set verbose on" |
214 gdb_test_multiple "core-file $corefile" $test { | 260 |
215 » -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0
-9a-f\]+) " { | 261 » gdb_test "file $file" "Reading symbols from .*done\\." "file" |
216 » # Missing "$gdb_prompt $" is intentional. | 262 |
217 » if {$expect_out(1,string) == "0x0"} { | 263 » set test "attach" |
218 » » set case "ZERO" | 264 » gdb_test_multiple "attach $pid" $test { |
219 » } else { | 265 » -re "Attaching to (program: .*, )?process $pid\r\n" { |
220 » » set case "NONZERO" | 266 » » # Missing "$gdb_prompt $" is intentional. |
| 267 » » pass $test |
221 } | 268 } |
222 » if {$displacement == $case || $displacement == "PRESENT"} { | 269 » } |
223 » » pass $test_displacement | 270 |
224 » » set displacement "FOUND-$displacement" | 271 » set test "attach final prompt" |
225 » } else { | 272 » set test_displacement "seen displacement message as $displacement" |
226 » » fail $test_displacement | 273 » gdb_test_multiple "" $test { |
| 274 » -re "Using PIE \\(Position Independent Executable\\) displacement (0
x\[0-9a-f\]+) " { |
| 275 » » # Missing "$gdb_prompt $" is intentional. |
| 276 » » if {$expect_out(1,string) == "0x0"} { |
| 277 » » set case "ZERO" |
| 278 » » } else { |
| 279 » » set case "NONZERO" |
| 280 » » } |
| 281 » » if {$displacement == $case || $displacement == "PRESENT"} { |
| 282 » » pass $test_displacement |
| 283 » » set displacement "FOUND-$displacement" |
| 284 » » } else { |
| 285 » » fail $test_displacement |
| 286 » » } |
| 287 » » exp_continue |
227 } | 288 } |
228 » exp_continue | 289 » -re "$gdb_prompt $" { |
| 290 » » pass $test |
| 291 » } |
229 } | 292 } |
230 » -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" { | 293 » if ![regexp {^(NONE|FOUND-.*)$} $displacement] { |
231 » # Do not check the binary filename as it may be truncated. | 294 » fail $test_displacement |
232 » pass $test | |
233 } | 295 } |
| 296 |
| 297 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+
+\[^\r\n\]*\\mmain\\M.*" "attach main bt" |
| 298 gdb_exit |
234 } | 299 } |
235 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { | 300 } |
236 » fail $test_displacement | |
237 } | |
238 | |
239 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[
^\r\n\]*\\mmain\\M.*" "core main bt" | |
240 }} | |
241 | |
242 proc test_attach_gdb {file pid displacement prefix} { with_test_prefix "$prefix"
{ | |
243 global gdb_prompt expect_out | |
244 | |
245 gdb_exit | |
246 gdb_start | |
247 | |
248 # Print the "PIE (Position Independent Executable) displacement" message. | |
249 gdb_test_no_output "set verbose on" | |
250 | |
251 gdb_test "file $file" "Reading symbols from .*done\\." "file" | |
252 | |
253 set test "attach" | |
254 gdb_test_multiple "attach $pid" $test { | |
255 » -re "Attaching to (program: .*, )?process $pid\r\n" { | |
256 » # Missing "$gdb_prompt $" is intentional. | |
257 » pass $test | |
258 » } | |
259 } | |
260 | |
261 set test "attach final prompt" | |
262 set test_displacement "seen displacement message as $displacement" | |
263 gdb_test_multiple "" $test { | |
264 » -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0
-9a-f\]+) " { | |
265 » # Missing "$gdb_prompt $" is intentional. | |
266 » if {$expect_out(1,string) == "0x0"} { | |
267 » » set case "ZERO" | |
268 » } else { | |
269 » » set case "NONZERO" | |
270 » } | |
271 » if {$displacement == $case || $displacement == "PRESENT"} { | |
272 » » pass $test_displacement | |
273 » » set displacement "FOUND-$displacement" | |
274 » } else { | |
275 » » fail $test_displacement | |
276 » } | |
277 » exp_continue | |
278 » } | |
279 » -re "$gdb_prompt $" { | |
280 » pass $test | |
281 » } | |
282 } | |
283 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { | |
284 » fail $test_displacement | |
285 } | |
286 | |
287 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[
^\r\n\]*\\mmain\\M.*" "attach main bt" | |
288 gdb_exit | |
289 }} | |
290 | 301 |
291 proc test_attach {file displacement {relink_args ""}} { | 302 proc test_attach {file displacement {relink_args ""}} { |
292 global board_info | 303 global board_info |
293 global exec | 304 global exec |
294 | 305 |
295 gdb_exit | 306 gdb_exit |
296 | 307 |
297 set test "sleep function started" | 308 set test "sleep function started" |
298 | 309 |
299 set command "${file} sleep" | 310 set command "${file} sleep" |
300 set res [remote_spawn host $command]; | 311 set res [remote_spawn host $command] |
301 if { $res < 0 || $res == "" } { | 312 if { $res < 0 || $res == "" } { |
302 perror "Spawning $command failed." | 313 perror "Spawning $command failed." |
303 fail $test | 314 fail $test |
304 return | 315 return |
305 } | 316 } |
306 set pid [exp_pid -i $res] | 317 set pid [exp_pid -i $res] |
307 gdb_expect { | 318 gdb_expect { |
308 -re "sleeping\r\n" { | 319 -re "sleeping\r\n" { |
309 pass $test | 320 pass $test |
310 } | 321 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 test_attach_gdb $exec $pid $displacement "attach-relink$relink" | 361 test_attach_gdb $exec $pid $displacement "attach-relink$relink" |
351 } | 362 } |
352 } | 363 } |
353 file_copy $interp_saved $interp | 364 file_copy $interp_saved $interp |
354 } | 365 } |
355 | 366 |
356 remote_exec host "kill -9 $pid" | 367 remote_exec host "kill -9 $pid" |
357 } | 368 } |
358 | 369 |
359 proc test_ld {file ifmain trynosym displacement} { | 370 proc test_ld {file ifmain trynosym displacement} { |
360 global srcdir subdir gdb_prompt expect_out inferior_exited_re | 371 global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp |
361 | 372 |
362 # First test normal `file'-command loaded $FILE with symbols. | 373 # First test normal `file'-command loaded $FILE with symbols. |
363 | 374 |
364 gdb_exit | 375 gdb_exit |
365 gdb_start | 376 gdb_start |
366 # Clear it to never find any separate debug infos in $debug_root. | 377 # Clear it to never find any separate debug infos in $debug_root. |
367 gdb_test_no_output "set debug-file-directory" | 378 gdb_test_no_output "set debug-file-directory" |
368 gdb_reinitialize_dir $srcdir/$subdir | 379 gdb_reinitialize_dir $srcdir/$subdir |
369 gdb_load $file | 380 gdb_load $file |
370 | 381 |
371 # Print the "PIE (Position Independent Executable) displacement" message. | 382 # Print the "PIE (Position Independent Executable) displacement" message. |
372 gdb_test_no_output "set verbose on" | 383 gdb_test_no_output "set verbose on" |
373 | 384 |
374 # We want to test the re-run of a PIE in the case where the executable | 385 # We want to test the re-run of a PIE in the case where the executable |
375 # is loaded with a different displacement, but disable-randomization | 386 # is loaded with a different displacement, but disable-randomization |
376 # prevents that from happening. So turn it off. | 387 # prevents that from happening. So turn it off. |
377 gdb_test "set disable-randomization off" | 388 gdb_test "set disable-randomization off" |
378 | 389 |
379 if $ifmain { | 390 if $ifmain { |
380 gdb_test_no_output "set args segv" | 391 gdb_test_no_output "set args segv" |
381 } else { | 392 } else { |
382 » global objdir binfile_test | 393 » global binfile_test |
383 | 394 |
384 # ld.so needs some executable to run to reach _dl_debug_state. | 395 # ld.so needs some executable to run to reach _dl_debug_state. |
385 » gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set arg
s OBJDIR/${subdir}/$binfile_test" | 396 » gdb_test_no_output "set args [standard_output_file $binfile_test]" \ |
| 397 » "set args OBJDIR/${subdir}/$binfile_test" |
386 } | 398 } |
387 | 399 |
388 reach "_dl_debug_state" "run" $displacement | 400 reach $solib_bp "run" $displacement |
389 | 401 |
390 gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt" | 402 gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" |
391 | 403 |
392 if $ifmain { | 404 if $ifmain { |
393 reach "main" continue "NONE" | 405 reach "main" continue "NONE" |
394 | 406 |
395 reach "libfunc" continue "NONE" | 407 reach "libfunc" continue "NONE" |
396 | 408 |
397 gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\
mmain\\M.*" "main bt" | 409 gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\
mmain\\M.*" "main bt" |
398 } | 410 } |
399 | 411 |
400 # Try re-run if the new PIE displacement takes effect. | 412 # Try re-run if the new PIE displacement takes effect. |
401 gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y
" | 413 gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y
" |
402 reach "_dl_debug_state" "run" $displacement | 414 reach $solib_bp "run" $displacement |
403 | 415 |
404 if $ifmain { | 416 if $ifmain { |
405 test_core $file $displacement | 417 test_core $file $displacement |
406 | 418 |
407 test_attach $file $displacement | 419 test_attach $file $displacement |
408 } | 420 } |
409 | 421 |
410 if !$trynosym { | 422 if !$trynosym { |
411 return | 423 return |
412 } | 424 } |
(...skipping 11 matching lines...) Expand all Loading... |
424 | 436 |
425 # Print the "PIE (Position Independent Executable) | 437 # Print the "PIE (Position Independent Executable) |
426 # displacement" message. | 438 # displacement" message. |
427 gdb_test_no_output "set verbose on" | 439 gdb_test_no_output "set verbose on" |
428 | 440 |
429 # Test no (error) message has been printed by `exec-file'. | 441 # Test no (error) message has been printed by `exec-file'. |
430 set escapedfile [string_to_regexp $file] | 442 set escapedfile [string_to_regexp $file] |
431 gdb_test "exec-file $file" "exec-file $escapedfile" "load" | 443 gdb_test "exec-file $file" "exec-file $escapedfile" "load" |
432 | 444 |
433 if $ifmain { | 445 if $ifmain { |
434 » reach "_dl_debug_state" run $displacement | 446 » reach $solib_bp run $displacement |
435 | 447 |
436 # Use two separate gdb_test_multiple statements to avoid timeouts du
e | 448 # Use two separate gdb_test_multiple statements to avoid timeouts du
e |
437 # to slow processing of wildcard capturing long output | 449 # to slow processing of wildcard capturing long output |
438 set test "info files" | 450 set test "info files" |
439 set entrynohex "" | 451 set entrynohex "" |
440 gdb_test_multiple $test $test { | 452 gdb_test_multiple $test $test { |
441 -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" { | 453 -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" { |
442 set entrynohex $expect_out(1,string) | 454 set entrynohex $expect_out(1,string) |
443 gdb_test_multiple "" $test { | 455 gdb_test_multiple "" $test { |
444 -re "\r\n$gdb_prompt $" { | 456 -re "\r\n$gdb_prompt $" { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 file_copy $interp_system $interp | 541 file_copy $interp_system $interp |
530 # Never call strip-debug before unprelink: | 542 # Never call strip-debug before unprelink: |
531 # prelink: ...: Section .note.gnu.build-id created after prelink
ing | 543 # prelink: ...: Section .note.gnu.build-id created after prelink
ing |
532 if ![prelinkNO $interp] { | 544 if ![prelinkNO $interp] { |
533 continue | 545 continue |
534 } | 546 } |
535 strip_debug $interp | 547 strip_debug $interp |
536 } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} { | 548 } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} { |
537 file_copy $interp_system $interp | 549 file_copy $interp_system $interp |
538 } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} { | 550 } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} { |
539 » file_copy $interp_system $interp | 551 » » file_copy $interp_system $interp |
540 file_copy $interp_system_debug "${interp}.debug" | 552 file_copy $interp_system_debug "${interp}.debug" |
541 # eu-unstrip: DWARF data in '...' not adjusted for prelinking bi
as; consider prelink -u | 553 # eu-unstrip: DWARF data in '...' not adjusted for prelinking bi
as; consider prelink -u |
542 if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} { | 554 if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} { |
543 continue | 555 continue |
544 } | 556 } |
545 set test "eu-unstrip unprelinked:[file tail $interp_system] + [f
ile tail $interp_system_debug] to [file tail $interp]" | 557 set test "eu-unstrip unprelinked:[file tail $interp_system] + [f
ile tail $interp_system_debug] to [file tail $interp]" |
546 set command "exec eu-unstrip -o $interp $interp ${interp}.debug" | 558 set command "exec eu-unstrip -o $interp $interp ${interp}.debug" |
547 verbose -log "command is $command" | 559 verbose -log "command is $command" |
548 if [catch $command] { | 560 if [catch $command] { |
549 setup_xfail *-*-* | 561 setup_xfail *-*-* |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 if {$binsepdebug != "NO"} { | 622 if {$binsepdebug != "NO"} { |
611 lappend opts {debug} | 623 lappend opts {debug} |
612 } | 624 } |
613 if {$binpie != "NO"} { | 625 if {$binpie != "NO"} { |
614 lappend opts {additional_flags=-fPIE -pie} | 626 lappend opts {additional_flags=-fPIE -pie} |
615 } | 627 } |
616 | 628 |
617 set dir ${exec}.d | 629 set dir ${exec}.d |
618 set relink_args [build_executable_own_libs ${test}.e
xp [file tail $exec] $srcfile $opts $interp $dir] | 630 set relink_args [build_executable_own_libs ${test}.e
xp [file tail $exec] $srcfile $opts $interp $dir] |
619 if {$relink_args == ""} { | 631 if {$relink_args == ""} { |
620 » » » » continue; | 632 » » » » continue |
621 } | 633 } |
622 | 634 |
623 if {$binsepdebug == "SEP"} { | 635 if {$binsepdebug == "SEP"} { |
624 gdb_gnu_strip_debug $exec | 636 gdb_gnu_strip_debug $exec |
625 } | 637 } |
626 | 638 |
627 if {$binpie == "NO"} { | 639 if {$binpie == "NO"} { |
628 set displacement "NONE" | 640 set displacement "NONE" |
629 } elseif {$binprelink == "NO"} { | 641 } elseif {$binprelink == "NO"} { |
630 set displacement "NONZERO" | 642 set displacement "NONZERO" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 681 } |
670 } | 682 } |
671 } | 683 } |
672 } | 684 } |
673 } | 685 } |
674 | 686 |
675 file delete $interp_saved | 687 file delete $interp_saved |
676 } | 688 } |
677 } | 689 } |
678 } | 690 } |
OLD | NEW |