Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: gdb/testsuite/gdb.base/break-interp.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2010-2012 Free Software Foundation, Inc. 1 # Copyright 2010-2012 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
(...skipping 12 matching lines...) Expand all
23 23
24 set test "break-interp" 24 set test "break-interp"
25 set binprefix ${objdir}/${subdir}/${test} 25 set binprefix ${objdir}/${subdir}/${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 ${objdir}/${subdir}/${test}.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 ${binfile_lib}] { 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]] != ""} {
40 return -1 40 return -1
41 } 41 }
42 42
43 if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} { 43 if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 pass $test 148 pass $test
149 } 149 }
150 } 150 }
151 -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n $gdb_prompt $" { 151 -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n $gdb_prompt $" {
152 if {$func == "_dl_debug_state"} { 152 if {$func == "_dl_debug_state"} {
153 fail $test 153 fail $test
154 } else { 154 } else {
155 pass $test 155 pass $test
156 } 156 }
157 } 157 }
158 » -re "Stopped due to shared library event\r\n$gdb_prompt $" { 158 » -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
159 if {$func == "_dl_debug_state"} { 159 if {$func == "_dl_debug_state"} {
160 if {$debug_state_count == 0} { 160 if {$debug_state_count == 0} {
161 # First stop does not yet relocate the _start function 161 # First stop does not yet relocate the _start function
162 # descriptor on ppc64. 162 # descriptor on ppc64.
163 set debug_state_count 1 163 set debug_state_count 1
164 send_gdb "continue\n" 164 send_gdb "continue\n"
165 exp_continue 165 exp_continue
166 } else { 166 } else {
167 pass $test 167 pass $test
168 } 168 }
169 } else { 169 } else {
170 fail $test 170 fail $test
171 } 171 }
172 } 172 }
173 } 173 }
174 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 174 if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
175 fail $test_displacement 175 fail $test_displacement
176 } 176 }
177 177
178 if {$func == "_dl_debug_state"} { 178 if {$func == "_dl_debug_state"} {
179 gdb_test_no_output "set stop-on-solib-events 0" 179 gdb_test_no_output "set stop-on-solib-events 0"
180 } 180 }
181 } 181 }
182 182
183 # `runto' does not check we stopped really at the function we specified. 183 # `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 184 # 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 185 # 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. 186 # bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
187 proc reach {func command displacement} { 187 proc reach {func command displacement} {
188 global pf_prefix 188 with_test_prefix "reach-$func" {
189 set old_ldprefix $pf_prefix 189 » reach_1 $func $command $displacement
190 lappend pf_prefix "reach-$func:" 190 }
191
192 reach_1 $func $command $displacement
193
194 set pf_prefix $old_ldprefix
195 } 191 }
196 192
197 proc test_core {file displacement} { 193 proc test_core {file displacement} { with_test_prefix "core" {
198 global srcdir subdir gdb_prompt expect_out 194 global srcdir subdir gdb_prompt expect_out
199 195
200 set corefile [core_find $file {} "segv"] 196 set corefile [core_find $file {} "segv"]
201 if {$corefile == ""} { 197 if {$corefile == ""} {
202 return 198 return
203 } 199 }
204 200
205 global pf_prefix
206 set old_ldprefix $pf_prefix
207 lappend pf_prefix "core:"
208
209 gdb_exit 201 gdb_exit
210 gdb_start 202 gdb_start
211 # Clear it to never find any separate debug infos in $debug_root. 203 # Clear it to never find any separate debug infos in $debug_root.
212 gdb_test_no_output "set debug-file-directory" \ 204 gdb_test_no_output "set debug-file-directory" \
213 "set debug-file-directory for core" 205 "set debug-file-directory for core"
214 gdb_reinitialize_dir $srcdir/$subdir 206 gdb_reinitialize_dir $srcdir/$subdir
215 gdb_load $file 207 gdb_load $file
216 208
217 # Print the "PIE (Position Independent Executable) displacement" message. 209 # Print the "PIE (Position Independent Executable) displacement" message.
218 gdb_test_no_output "set verbose on" 210 gdb_test_no_output "set verbose on"
(...skipping 19 matching lines...) Expand all
238 -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" { 230 -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" {
239 # Do not check the binary filename as it may be truncated. 231 # Do not check the binary filename as it may be truncated.
240 pass $test 232 pass $test
241 } 233 }
242 } 234 }
243 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 235 if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
244 fail $test_displacement 236 fail $test_displacement
245 } 237 }
246 238
247 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[ ^\r\n\]*\\mmain\\M.*" "core main bt" 239 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[ ^\r\n\]*\\mmain\\M.*" "core main bt"
240 }}
248 241
249 set pf_prefix $old_ldprefix 242 proc test_attach_gdb {file pid displacement prefix} { with_test_prefix "$prefix" {
250 }
251
252 proc test_attach_gdb {file pid displacement prefix} {
253 global gdb_prompt expect_out 243 global gdb_prompt expect_out
254 244
255 global pf_prefix
256 set old_ldprefix $pf_prefix
257 lappend pf_prefix "$prefix:"
258
259 gdb_exit 245 gdb_exit
260 gdb_start 246 gdb_start
261 247
262 # Print the "PIE (Position Independent Executable) displacement" message. 248 # Print the "PIE (Position Independent Executable) displacement" message.
263 gdb_test_no_output "set verbose on" 249 gdb_test_no_output "set verbose on"
264 250
265 if {$file != ""} { 251 gdb_test "file $file" "Reading symbols from .*done\\." "file"
266 » gdb_test "file $file" "Reading symbols from .*done\\." "file"
267 }
268 252
269 set test "attach" 253 set test "attach"
270 gdb_test_multiple "attach $pid" $test { 254 gdb_test_multiple "attach $pid" $test {
271 -re "Attaching to (program: .*, )?process $pid\r\n" { 255 -re "Attaching to (program: .*, )?process $pid\r\n" {
272 # Missing "$gdb_prompt $" is intentional. 256 # Missing "$gdb_prompt $" is intentional.
273 pass $test 257 pass $test
274 } 258 }
275 } 259 }
276 260
277 set test "attach final prompt" 261 set test "attach final prompt"
(...skipping 17 matching lines...) Expand all
295 -re "$gdb_prompt $" { 279 -re "$gdb_prompt $" {
296 pass $test 280 pass $test
297 } 281 }
298 } 282 }
299 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 283 if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
300 fail $test_displacement 284 fail $test_displacement
301 } 285 }
302 286
303 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[ ^\r\n\]*\\mmain\\M.*" "attach main bt" 287 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[ ^\r\n\]*\\mmain\\M.*" "attach main bt"
304 gdb_exit 288 gdb_exit
305 289 }}
306 set pf_prefix $old_ldprefix
307 }
308 290
309 proc test_attach {file displacement {relink_args ""}} { 291 proc test_attach {file displacement {relink_args ""}} {
310 global board_info 292 global board_info
293 global exec
311 294
312 gdb_exit 295 gdb_exit
313 296
314 set test "sleep function started" 297 set test "sleep function started"
315 298
316 set command "${file} sleep" 299 set command "${file} sleep"
317 set res [remote_spawn host $command]; 300 set res [remote_spawn host $command];
318 if { $res < 0 || $res == "" } { 301 if { $res < 0 || $res == "" } {
319 perror "Spawning $command failed." 302 perror "Spawning $command failed."
320 fail $test 303 fail $test
321 return 304 return
322 } 305 }
323 set pid [exp_pid -i $res] 306 set pid [exp_pid -i $res]
324 gdb_expect { 307 gdb_expect {
325 -re "sleeping\r\n" { 308 -re "sleeping\r\n" {
326 pass $test 309 pass $test
327 } 310 }
328 eof { 311 eof {
329 fail "$test (eof)" 312 fail "$test (eof)"
330 return 313 return
331 } 314 }
332 timeout { 315 timeout {
333 fail "$test (timeout)" 316 fail "$test (timeout)"
334 return 317 return
335 } 318 }
336 } 319 }
337 320
338 if {$relink_args == ""} { 321 if {$relink_args == ""} {
339 » test_attach_gdb "" $pid $displacement "attach" 322 » test_attach_gdb $exec $pid $displacement "attach"
340 } else { 323 } else {
341 # These could be rather passed as arguments. 324 # These could be rather passed as arguments.
342 » global exec interp_saved interp 325 » global interp_saved interp
343 326
344 foreach relink {YES NO} { 327 foreach relink {YES NO} {
345 # Formerly this test was testing only prelinking of $EXEC. As the 328 # Formerly this test was testing only prelinking of $EXEC. As the
346 # prelink command automatically prelinks all of $EXEC's libraries, 329 # prelink command automatically prelinks all of $EXEC's libraries,
347 # even $INTERP got prelinked. Therefore, we formerly had to 330 # even $INTERP got prelinked. Therefore, we formerly had to
348 # `[file_copy $interp_saved $interp]' to make $INTERP not affected 331 # `[file_copy $interp_saved $interp]' to make $INTERP not affected
349 # by this prelinking of $EXEC. 332 # by this prelinking of $EXEC.
350 # 333 #
351 # But now we need to test even prelinking of $INTERP. We could 334 # But now we need to test even prelinking of $INTERP. We could
352 # create a separate test to test just the $INTERP prelinking. For 335 # create a separate test to test just the $INTERP prelinking. For
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 if $ifmain { 404 if $ifmain {
422 test_core $file $displacement 405 test_core $file $displacement
423 406
424 test_attach $file $displacement 407 test_attach $file $displacement
425 } 408 }
426 409
427 if !$trynosym { 410 if !$trynosym {
428 return 411 return
429 } 412 }
430 413
431 global pf_prefix 414 with_test_prefix "symbol-less" {
432 set old_ldprefix $pf_prefix 415 » # Test also `exec-file'-command loaded $FILE - therefore
433 lappend pf_prefix "symbol-less:" 416 » # without symbols. SYMBOL_OBJFILE is not available and only
417 » # EXEC_BFD must be used.
434 418
435 # Test also `exec-file'-command loaded $FILE - therefore without symbols. 419 » gdb_exit
436 # SYMBOL_OBJFILE is not available and only EXEC_BFD must be used. 420 » gdb_start
421 » # Clear it to never find any separate debug infos in $debug_root.
422 » gdb_test_no_output "set debug-file-directory"
423 » gdb_reinitialize_dir $srcdir/$subdir
437 424
438 gdb_exit 425 » # Print the "PIE (Position Independent Executable)
439 gdb_start 426 » # displacement" message.
440 # Clear it to never find any separate debug infos in $debug_root. 427 » gdb_test_no_output "set verbose on"
441 gdb_test_no_output "set debug-file-directory"
442 gdb_reinitialize_dir $srcdir/$subdir
443 428
444 # Print the "PIE (Position Independent Executable) displacement" message. 429 » # Test no (error) message has been printed by `exec-file'.
445 gdb_test_no_output "set verbose on" 430 » set escapedfile [string_to_regexp $file]
431 » gdb_test "exec-file $file" "exec-file $escapedfile" "load"
446 432
447 # Test no (error) message has been printed by `exec-file'. 433 » if $ifmain {
448 set escapedfile [string_to_regexp $file] 434 » reach "_dl_debug_state" run $displacement
449 gdb_test "exec-file $file" "exec-file $escapedfile" "load"
450 435
451 if $ifmain { 436 » # Use two separate gdb_test_multiple statements to avoid timeouts du e
452 » reach "_dl_debug_state" run $displacement 437 » # to slow processing of wildcard capturing long output
438 » set test "info files"
439 » set entrynohex ""
440 » gdb_test_multiple $test $test {
441 » » -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" {
442 » » set entrynohex $expect_out(1,string)
443 » » gdb_test_multiple "" $test {
444 » » » -re "\r\n$gdb_prompt $" {
445 » » » pass $test
446 » » » }
447 » » }
448 » » }
449 » }
453 450
454 » # Use two separate gdb_test_multiple statements to avoid timeouts due 451 » # `info sym' cannot be tested for .opd as the binary may not have
455 » # to slow processing of wildcard capturing long output 452 » # symbols.
456 » set test "info files" 453 » if {[istarget powerpc64-*] && [is_lp64_target]} {
457 » set entrynohex "" 454 » » set test "convert entry point"
458 » gdb_test_multiple $test $test { 455 » » gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test {
459 » -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" { 456 » » -re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r \n$gdb_prompt $" {
460 » » set entrynohex $expect_out(1,string) 457 » » » set entrynohex $expect_out(2,string)
461 » » gdb_test_multiple "" $test {
462 » » -re "\r\n$gdb_prompt $" {
463 pass $test 458 pass $test
464 } 459 }
465 } 460 }
466 } 461 }
467 » } 462 » if {$entrynohex != ""} {
463 » » gdb_test "break *0x$entrynohex" "" "break at entry point"
464 » » gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
465 » }
466 » } else {
467 » # There is no symbol to break at ld.so. Moreover it can
468 » # exit with an error code.
468 469
469 » # `info sym' cannot be tested for .opd as the binary may not have 470 » set test "ld.so exit"
470 » # symbols. 471 » set test_displacement "seen displacement message as $displacement"
471 » if {[istarget powerpc64-*] && [is_lp64_target]} { 472 » gdb_test_multiple "run" $test {
472 » set test "convert entry point" 473 » » -re "Using PIE \\(Position Independent Executable\\) displacemen t (0x\[0-9a-f\]+) " {
473 » gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test { 474 » » # Missing "$gdb_prompt $" is intentional.
474 » » -re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r\n$g db_prompt $" { 475 » » if {$expect_out(1,string) == "0x0"} {
475 » » set entrynohex $expect_out(2,string) 476 » » » set case "ZERO"
477 » » } else {
478 » » » set case "NONZERO"
479 » » }
480 » » if {$displacement == $case || $displacement == "PRESENT"} {
481 » » » pass $test_displacement
482 » » » set displacement "FOUND-$displacement"
483 » » } else {
484 » » » fail $test_displacement
485 » » }
486 » » exp_continue
487 » » }
488 » » -re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_ prompt $" {
489 » » # Do not check the binary filename as it may be truncated.
476 pass $test 490 pass $test
477 } 491 }
478 } 492 }
479 » } 493 » if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
480 » if {$entrynohex != ""} { 494 » » fail $test_displacement
481 » gdb_test "break *0x$entrynohex" "" "break at entry point"
482 » gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
483 » }
484 } else {
485 » # There is no symbol to break at ld.so. Moreover it can exit with an
486 » # error code.
487
488 » set test "ld.so exit"
489 » set test_displacement "seen displacement message as $displacement"
490 » gdb_test_multiple "run" $test {
491 » -re "Using PIE \\(Position Independent Executable\\) displacement (0 x\[0-9a-f\]+) " {
492 » » # Missing "$gdb_prompt $" is intentional.
493 » » if {$expect_out(1,string) == "0x0"} {
494 » » set case "ZERO"
495 » » } else {
496 » » set case "NONZERO"
497 » » }
498 » » if {$displacement == $case || $displacement == "PRESENT"} {
499 » » pass $test_displacement
500 » » set displacement "FOUND-$displacement"
501 » » } else {
502 » » fail $test_displacement
503 » » }
504 » » exp_continue
505 » }
506 » -re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_prom pt $" {
507 » » # Do not check the binary filename as it may be truncated.
508 » » pass $test
509 } 495 }
510 } 496 }
511 if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
512 fail $test_displacement
513 }
514 } 497 }
515
516 set pf_prefix $old_ldprefix
517 } 498 }
518 499
519 # Create separate binaries for each testcase - to make the possible reported 500 # Create separate binaries for each testcase - to make the possible reported
520 # problem reproducible after the whole test run finishes. 501 # problem reproducible after the whole test run finishes.
521 502
522 set old_ldprefix $pf_prefix
523 foreach ldprelink {NO YES} { 503 foreach ldprelink {NO YES} {
524 foreach ldsepdebug {NO IN SEP} { 504 foreach ldsepdebug {NO IN SEP} {
525 # Skip running the ldsepdebug test if we do not have system separate 505 # Skip running the ldsepdebug test if we do not have system separate
526 # debug info available. 506 # debug info available.
527 if {$interp_system_debug == "" && $ldsepdebug == "SEP"} { 507 if {$interp_system_debug == "" && $ldsepdebug == "SEP"} {
528 continue 508 continue
529 } 509 }
530 510
531 set ldname "LDprelink${ldprelink}debug${ldsepdebug}" 511 set ldname "LDprelink${ldprelink}debug${ldsepdebug}"
532 set interp $binprefix-$ldname 512 set interp $binprefix-$ldname
533 513
534 # prelink needs to always prelink all the dependencies to do any file 514 # prelink needs to always prelink all the dependencies to do any file
535 # modifications of its files. ld.so also needs all the dependencies to 515 # modifications of its files. ld.so also needs all the dependencies to
536 # be prelinked to omit the relocation process. In-memory file offsets 516 # be prelinked to omit the relocation process. In-memory file offsets
537 # are not dependent whether ld.so went the prelink way or through the 517 # are not dependent whether ld.so went the prelink way or through the
538 # relocation process. 518 # relocation process.
539 # 519 #
540 # For GDB we are not interested whether prelink succeeds as it is 520 # For GDB we are not interested whether prelink succeeds as it is
541 # transparent to GDB. GDB is being tested for differences of file 521 # transparent to GDB. GDB is being tested for differences of file
542 # offsets vs. in-memory offsets. So we have to prelink even ld.so for 522 # offsets vs. in-memory offsets. So we have to prelink even ld.so for
543 # the BIN modification to happen but we need to restore the original 523 # the BIN modification to happen but we need to restore the original
544 # possibly unprelinked ld.so to test all the combinations for GDB. 524 # possibly unprelinked ld.so to test all the combinations for GDB.
545 set interp_saved ${interp}-saved 525 set interp_saved ${interp}-saved
546 526
547 » set pf_prefix $old_ldprefix 527 » with_test_prefix "$ldname" {
548 » lappend pf_prefix "$ldname:" 528 » if {$ldsepdebug == "NO"} {
529 » » file_copy $interp_system $interp
530 » » # Never call strip-debug before unprelink:
531 » » # prelink: ...: Section .note.gnu.build-id created after prelink ing
532 » » if ![prelinkNO $interp] {
533 » » continue
534 » » }
535 » » strip_debug $interp
536 » } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} {
537 » » file_copy $interp_system $interp
538 » } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} {
539 » file_copy $interp_system $interp
540 » » file_copy $interp_system_debug "${interp}.debug"
541 » » # eu-unstrip: DWARF data in '...' not adjusted for prelinking bi as; consider prelink -u
542 » » if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} {
543 » » continue
544 » » }
545 » » 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"
547 » » verbose -log "command is $command"
548 » » if [catch $command] {
549 » » setup_xfail *-*-*
550 » » fail $test
551 » » continue
552 » » } else {
553 » » pass $test
554 » » }
555 » } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
556 » » file_copy $interp_system $interp
557 » » # eu-unstrip: DWARF data in '...' not adjusted for prelinking bi as; consider prelink -u
558 » » if ![prelinkNO $interp] {
559 » » continue
560 » » }
561 » » gdb_gnu_strip_debug $interp
562 » } elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} {
563 » » file_copy $interp_system $interp
564 » » file_copy $interp_system_debug "${interp}.debug"
565 » }
549 566
550 » if {$ldsepdebug == "NO"} { 567 » if {$ldsepdebug == "SEP"} {
551 » file_copy $interp_system $interp 568 » » if ![prelinkNO "${interp}.debug"] {
552 » # Never call strip-debug before unprelink: 569 » » continue
553 » # prelink: ...: Section .note.gnu.build-id created after prelinking 570 » » }
554 » if ![prelinkNO $interp] { 571 » } else {
572 » » file delete "${interp}.debug"
573 » }
574
575 » if ![prelink$ldprelink $interp] {
555 continue 576 continue
556 } 577 }
557 » strip_debug $interp 578 » if {$ldprelink == "NO"} {
558 » } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} { 579 » » set displacement "NONZERO"
559 » file_copy $interp_system $interp 580 » } else {
560 » } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} { 581 » » # x86* kernel loads prelinked PIE binary at its
561 » file_copy $interp_system $interp 582 » » # prelinked address but ppc* kernel loads it at a
562 » file_copy $interp_system_debug "${interp}.debug" 583 » » # random address. prelink normally skips PIE binaries
563 » # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u 584 » » # during the system scan.
564 » if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} { 585 » » set displacement "PRESENT"
586 » }
587 » test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
588
589 » if ![file_copy $interp $interp_saved] {
565 continue 590 continue
566 } 591 }
567 set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
568 set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
569 verbose -log "command is $command"
570 if [catch $command] {
571 setup_xfail *-*-*
572 fail $test
573 continue
574 } else {
575 pass $test
576 }
577 } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
578 file_copy $interp_system $interp
579 # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
580 if ![prelinkNO $interp] {
581 continue
582 }
583 gdb_gnu_strip_debug $interp
584 } elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} {
585 file_copy $interp_system $interp
586 file_copy $interp_system_debug "${interp}.debug"
587 }
588 592
589 » if {$ldsepdebug == "SEP"} { 593 » foreach binprelink {NO YES} {
590 » if ![prelinkNO "${interp}.debug"] { 594 » » foreach binsepdebug {NO IN SEP} {
591 » » continue 595 » » # "ATTACH" is like "YES" but it is modified during
592 » } 596 » » # run. It cannot be used for problem
593 » } else { 597 » » # reproducibility after the testcase ends.
594 » file delete "${interp}.debug" 598 » » foreach binpie {NO YES ATTACH} {
595 » } 599 » » » # This combination is not possible, non-PIE (fixed addre ss)
600 » » » # binary cannot be prelinked to any (other) address.
601 » » » if {$binprelink == "YES" && $binpie == "NO"} {
602 » » » continue
603 » » » }
596 604
597 » if ![prelink$ldprelink $interp] { 605 » » » set binname "BINprelink${binprelink}debug${binsepdebug}p ie${binpie}"
598 » continue 606 » » » set exec $binprefix-$binname
599 » }
600 » if {$ldprelink == "NO"} {
601 » set displacement "NONZERO"
602 » } else {
603 » # x86* kernel loads prelinked PIE binary at its prelinked address
604 » # but ppc* kernel loads it at a random address. prelink normally
605 » # skips PIE binaries during the system scan.
606 » set displacement "PRESENT"
607 » }
608 » test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
609 607
610 » if ![file_copy $interp $interp_saved] { 608 » » » with_test_prefix "$binname" {
611 » continue 609 » » » set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirn ame $binfile_lib]"
612 » } 610 » » » if {$binsepdebug != "NO"} {
613 » set old_binprefix $pf_prefix 611 » » » » lappend opts {debug}
614 » foreach binprelink {NO YES} { 612 » » » }
615 » foreach binsepdebug {NO IN SEP} { 613 » » » if {$binpie != "NO"} {
616 » » # "ATTACH" is like "YES" but it is modified during run. 614 » » » » lappend opts {additional_flags=-fPIE -pie}
617 » » # It cannot be used for problem reproducibility after the 615 » » » }
618 » » # testcase ends.
619 » » foreach binpie {NO YES ATTACH} {
620 » » # This combination is not possible, non-PIE (fixed address)
621 » » # binary cannot be prelinked to any (other) address.
622 » » if {$binprelink == "YES" && $binpie == "NO"} {
623 » » » continue
624 » » }
625 616
626 » » set binname "BINprelink${binprelink}debug${binsepdebug}pie${ binpie}" 617 » » » set dir ${exec}.d
627 » » set exec $binprefix-$binname 618 » » » set relink_args [build_executable_own_libs ${test}.e xp [file tail $exec] $srcfile $opts $interp $dir]
619 » » » if {$relink_args == ""} {
620 » » » » continue;
621 » » » }
628 622
629 » » set pf_prefix $old_binprefix 623 » » » if {$binsepdebug == "SEP"} {
630 » » lappend pf_prefix "$binname:" 624 » » » » gdb_gnu_strip_debug $exec
625 » » » }
631 626
632 » » set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $bin file_lib]" 627 » » » if {$binpie == "NO"} {
633 » » if {$binsepdebug != "NO"} { 628 » » » » set displacement "NONE"
634 » » » lappend opts {debug} 629 » » » } elseif {$binprelink == "NO"} {
635 » » } 630 » » » » set displacement "NONZERO"
636 » » if {$binpie != "NO"} { 631 » » » } else {
637 » » » lappend opts {additional_flags=-fPIE -pie} 632 » » » » # x86* kernel loads prelinked PIE binary at its prelinked
638 » » } 633 » » » » # address but ppc* kernel loads it at a random a ddress.
634 » » » » # prelink normally skips PIE binaries during the system scan.
635 » » » » set displacement "PRESENT"
636 » » » }
639 637
640 » » set dir ${exec}.d 638 » » » if {[prelink$binprelink $relink_args [file tail $exe c]]
641 » » set relink_args [build_executable_own_libs ${test}.exp [file tail $exec] $srcfile $opts $interp $dir] 639 » » » » && [file_copy $interp_saved $interp]} {
642 » » if {$relink_args == ""} { 640 » » » » if {$binpie != "ATTACH"} {
643 » » » continue; 641 » » » » test_ld $exec 1 [expr {$binsepdebug == "NO"} ] $displacement
644 » » } 642 » » » » } else {
643 » » » » # If the file has been randomly prelinked it must be
644 » » » » # "NONZERO". We could see "ZERO" only if it was unprelinked
645 » » » » # and it is now running at the same address - which is 0 but
646 » » » » # executable can never run at address 0.
645 647
646 » » if {$binsepdebug == "SEP"} { 648 » » » » set displacement "NONZERO"
647 » » » gdb_gnu_strip_debug $exec 649 » » » » test_attach $exec $displacement $relink_args
648 » » }
649 650
650 » » if {$binpie == "NO"} { 651 » » » » # ATTACH means that executables and librarie s have been
651 » » » set displacement "NONE" 652 » » » » # modified after they have been run. They c annot be reused
652 » » } elseif {$binprelink == "NO"} { 653 » » » » # for problem reproducibility after the test case ends in
653 » » » set displacement "NONZERO" 654 » » » » # the ATTACH case. Therefore they are rathe r deleted not
654 » » } else { 655 » » » » # to confuse after the run finishes.
655 » » » # x86* kernel loads prelinked PIE binary at its 656 » » » » set exec_debug [system_debug_get $exec]
656 » » » # prelinked address but ppc* kernel loads it at 657 » » » » if {$exec_debug != ""} {
657 » » » # a random address. prelink normally skips PIE 658 » » » » » # `file delete [glob "${exec_debug}*"]' does not work.
658 » » » # binaries during the system scan. 659 » » » » » foreach f [glob "${exec_debug}*"] {
659 » » » set displacement "PRESENT" 660 » » » » » file delete $f
660 » » } 661 » » » » » }
661 662 » » » » }
662 » » if {[prelink$binprelink $relink_args [file tail $exec]] 663 » » » » file delete -force $dir
663 » » && [file_copy $interp_saved $interp]} { 664 » » » » # `file delete [glob "${exec}*"]' does not w ork.
664 » » » if {$binpie != "ATTACH"} { 665 » » » » foreach f [glob "${exec}*"] {
665 » » » test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displ acement 666 » » » » » file delete $f
666 » » » } else { 667 » » » » }
667 » » » # If the file has been randomly prelinked it must
668 » » » # be "NONZERO". We could see "ZERO" only if it was
669 » » » # unprelinked and it is now running at the same
670 » » » # address - which is 0 but executable can never run
671 » » » # at address 0.
672
673 » » » set displacement "NONZERO"
674 » » » test_attach $exec $displacement $relink_args
675
676 » » » # ATTACH means that executables and libraries have
677 » » » # been modified after they have been run. They
678 » » » # cannot be reused for problem reproducibility after
679 » » » # the testcase ends in the ATTACH case. Therefore
680 » » » # they are rather deleted not to confuse after the
681 » » » # run finishes.
682 » » » set exec_debug [system_debug_get $exec]
683 » » » if {$exec_debug != ""} {
684 » » » » # `file delete [glob "${exec_debug}*"]' does not work.
685 » » » » foreach f [glob "${exec_debug}*"] {
686 » » » » file delete $f
687 } 668 }
688 } 669 }
689 file delete -force $dir
690 # `file delete [glob "${exec}*"]' does not work.
691 foreach f [glob "${exec}*"] {
692 file delete $f
693 }
694 } 670 }
695 } 671 }
696 } 672 }
697 } 673 }
674
675 file delete $interp_saved
698 } 676 }
699
700 file delete $interp_saved
701 } 677 }
702 } 678 }
703 set pf_prefix $old_ldprefix
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.base/break-inline.exp ('k') | gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698