1# Copyright 2010-2020 Free Software Foundation, Inc. 2 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 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 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/>. 15 16# This test only works on GNU/Linux. 17if { ![isnative] || [is_remote host] || [use_gdb_stub] 18 || ![istarget *-linux*] || [skip_shlib_tests]} { 19 continue 20} 21 22load_lib prelink-support.exp 23 24set test "break-interp" 25set binprefix [standard_output_file ${test}] 26# Only to get the $interp_system name. 27set srcfile_test "start.c" 28set binfile_test ${test}-test 29set binfile_lib ${binprefix}.so 30set srcfile "${test}-main.c" 31set srcfile_lib "${test}-lib.c" 32 33if [get_compiler_info] { 34 return -1 35} 36 37# Use -soname so that the new library gets copied by build_executable_own_libs. 38 39if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] != ""} { 40 return -1 41} 42 43if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} { 44 return -1 45} 46 47# Note: The separate debug info file content build-id/crc32 are not verified 48# contrary to the GDB search algorithm skipping non-matching ones. 49proc system_debug_get {exec} { 50 global debug_root 51 52 set exec_build_id_debug [build_id_debug_filename_get $exec] 53 set debug_base "[file tail $exec].debug" 54 set exec_dir [file dirname $exec] 55 56 # isfile returns 1 even for symlinks to files. 57 set retval $debug_root/$exec_build_id_debug 58 if [file isfile $retval] { 59 return $retval 60 } 61 set retval $exec_dir/$debug_base 62 if [file isfile $retval] { 63 return $retval 64 } 65 set retval $exec_dir/.debug/$debug_base 66 if [file isfile $retval] { 67 return $retval 68 } 69 set retval $debug_root/$exec_dir/$debug_base 70 if [file isfile $retval] { 71 return $retval 72 } 73 return "" 74} 75 76gdb_exit 77gdb_start 78set debug_root "" 79set test "show debug-file-directory" 80gdb_test_multiple $test $test { 81 -re "The directory where separate debug symbols are searched for is \"(.*)\".\r\n$gdb_prompt $" { 82 set debug_root $expect_out(1,string) 83 } 84} 85 86set interp_system [section_get [standard_output_file $binfile_test] .interp] 87set interp_system_debug [system_debug_get $interp_system] 88verbose -log "$interp_system has debug $interp_system_debug" 89 90proc prelinkNO {arg {name ""}} { 91 return [prelink_no $arg $name] 92} 93 94proc prelinkYES {arg {name ""}} { 95 return [prelink_yes $arg $name] 96} 97 98proc strip_debug {dest} { 99 set test "strip [file tail $dest]" 100 set strip_program [transform strip] 101 set command "exec $strip_program --strip-debug $dest" 102 verbose -log "command is $command" 103 if [catch $command] { 104 fail $test 105 return 0 106 } else { 107 pass $test 108 return 1 109 } 110} 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 117set solib_bp {(_dl_debug_state|dl_main)} 118 119# Implementation of reach. 120 121proc reach_1 {func command displacement} { 122 global gdb_prompt expect_out solib_bp 123 124 if {$func == $solib_bp} { 125 # Breakpoint on _dl_debug_state can have problems due to its overlap 126 # with the existing internal breakpoint from GDB. 127 gdb_test_no_output "set stop-on-solib-events 1" 128 } elseif {! [gdb_breakpoint $func allow-pending]} { 129 return 130 } 131 132 set test "reach" 133 set test_displacement "seen displacement message as $displacement" 134 set debug_state_count 0 135 gdb_test_multiple $command $test { 136 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { 137 # Missing "$gdb_prompt $" is intentional. 138 if {$expect_out(1,string) == "0x0"} { 139 set case "ZERO" 140 } else { 141 set case "NONZERO" 142 } 143 if {$displacement == $case || $displacement == "PRESENT"} { 144 pass $test_displacement 145 set displacement "FOUND-$displacement" 146 } else { 147 fail $test_displacement 148 } 149 exp_continue 150 } 151 -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" { 152 if {$func == $solib_bp} { 153 fail $test 154 } else { 155 pass $test 156 } 157 } 158 -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" { 159 if {$func == $solib_bp} { 160 fail $test 161 } else { 162 pass $test 163 } 164 } 165 -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" { 166 if {$func == $solib_bp} { 167 if {$debug_state_count == 0} { 168 # First stop does not yet relocate the _start function 169 # descriptor on ppc64. 170 set debug_state_count 1 171 send_gdb "continue\n" 172 exp_continue 173 } else { 174 pass $test 175 } 176 } else { 177 fail $test 178 } 179 } 180 } 181 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 182 fail $test_displacement 183 } 184 185 if {$func == $solib_bp} { 186 gdb_test_no_output "set stop-on-solib-events 0" 187 } 188} 189 190# `runto' does not check we stopped really at the function we specified. 191# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for 192# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0 193# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid. 194# 195# The optional ITERATION parameter is used in order to make unique 196# test prefixes, when calling this proc with the same FUNC name 197# provide a unique ITERATION value for each call. 198proc reach {func command displacement {iteration 1}} { 199 set prefix "reach-$func" 200 if { $iteration > 1 } { 201 set prefix "$prefix-$iteration" 202 } 203 with_test_prefix $prefix { 204 reach_1 $func $command $displacement 205 } 206} 207 208proc test_core {file displacement} { 209 with_test_prefix "core" { 210 global srcdir subdir gdb_prompt expect_out 211 212 set corefile [core_find $file {} "segv"] 213 if {$corefile == ""} { 214 return 215 } 216 217 gdb_exit 218 gdb_start 219 # Clear it to never find any separate debug infos in $debug_root. 220 gdb_test_no_output "set debug-file-directory" \ 221 "set debug-file-directory for core" 222 gdb_reinitialize_dir $srcdir/$subdir 223 gdb_load $file 224 225 # Print the "PIE (Position Independent Executable) displacement" message. 226 gdb_test_no_output "set verbose on" 227 228 set test "core loaded" 229 set test_displacement "seen displacement message as $displacement" 230 gdb_test_multiple "core-file $corefile" $test { 231 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { 232 # Missing "$gdb_prompt $" is intentional. 233 if {$expect_out(1,string) == "0x0"} { 234 set case "ZERO" 235 } else { 236 set case "NONZERO" 237 } 238 if {$displacement == $case || $displacement == "PRESENT"} { 239 pass $test_displacement 240 set displacement "FOUND-$displacement" 241 } else { 242 fail $test_displacement 243 } 244 exp_continue 245 } 246 -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" { 247 # Do not check the binary filename as it may be truncated. 248 pass $test 249 } 250 } 251 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 252 fail $test_displacement 253 } 254 gdb_test_no_output "set verbose off" 255 256 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt" 257 } 258} 259 260proc test_attach_gdb {file pid displacement prefix} { 261 with_test_prefix "$prefix" { 262 global gdb_prompt expect_out 263 264 gdb_exit 265 gdb_start 266 267 # Print the "PIE (Position Independent Executable) displacement" message. 268 gdb_test_no_output "set verbose on" 269 270 gdb_test "file $file" "Reading symbols from .*" "file" 271 272 set test "attach" 273 gdb_test_multiple "attach $pid" $test { 274 -re "Attaching to (program: .*, )?process $pid\r\n" { 275 # Missing "$gdb_prompt $" is intentional. 276 pass $test 277 } 278 } 279 280 set test "attach final prompt" 281 set test_displacement "seen displacement message as $displacement" 282 gdb_test_multiple "" $test { 283 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { 284 # Missing "$gdb_prompt $" is intentional. 285 if {$expect_out(1,string) == "0x0"} { 286 set case "ZERO" 287 } else { 288 set case "NONZERO" 289 } 290 if {$displacement == $case || $displacement == "PRESENT"} { 291 pass $test_displacement 292 set displacement "FOUND-$displacement" 293 } else { 294 fail $test_displacement 295 } 296 exp_continue 297 } 298 -re "$gdb_prompt $" { 299 pass $test 300 } 301 } 302 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 303 fail $test_displacement 304 } 305 gdb_test_no_output "set verbose off" 306 307 gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt" 308 gdb_exit 309 } 310} 311 312proc test_attach {file displacement {relink_args ""}} { 313 global board_info 314 global exec 315 316 gdb_exit 317 318 set test "sleep function started" 319 320 set command "${file} sleep" 321 set test_spawn_id [remote_spawn host $command] 322 if { $test_spawn_id < 0 || $test_spawn_id == "" } { 323 perror "Spawning $command failed." 324 fail $test 325 return 326 } 327 set pid [spawn_id_get_pid $test_spawn_id] 328 gdb_expect { 329 -re "sleeping\r\n" { 330 pass $test 331 } 332 eof { 333 fail "$test (eof)" 334 wait -i $test_spawn_id 335 return 336 } 337 timeout { 338 fail "$test (timeout)" 339 kill_wait_spawned_process $test_spawn_id 340 return 341 } 342 } 343 344 if {$relink_args == ""} { 345 test_attach_gdb $exec $pid $displacement "attach" 346 } else { 347 # These could be rather passed as arguments. 348 global interp_saved interp 349 350 foreach relink {YES NO} { 351 # Formerly this test was testing only prelinking of $EXEC. As the 352 # prelink command automatically prelinks all of $EXEC's libraries, 353 # even $INTERP got prelinked. Therefore, we formerly had to 354 # `[file_copy $interp_saved $interp]' to make $INTERP not affected 355 # by this prelinking of $EXEC. 356 # 357 # But now we need to test even prelinking of $INTERP. We could 358 # create a separate test to test just the $INTERP prelinking. For 359 # test simplicity, we merged this test and the test above by not 360 # restoring $INTERP after $EXEC prelink. $INTERP gets restored 361 # later below. 362 # 363 # `(wrong library or version mismatch?)' messages are printed for 364 # $binfile_lib on platforms converting REL->RELA relocations by 365 # prelink (such as on i386). There is no reliable way to verify 366 # the library file matches the running library in such case but 367 # GDB at least attempts to set the right displacement. We test 368 # `libfunc' is present in the backtrace and therefore the 369 # displacement has been guessed right. 370 371 if [prelink$relink $relink_args [file tail $exec]] { 372 # /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)". 373 test_attach_gdb $exec $pid $displacement "attach-relink$relink" 374 } 375 } 376 file_copy $interp_saved $interp 377 } 378 379 kill_wait_spawned_process $test_spawn_id 380} 381 382proc test_ld {file ifmain trynosym displacement} { 383 global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp 384 385 # First test normal `file'-command loaded $FILE with symbols. 386 387 gdb_exit 388 gdb_start 389 # Clear it to never find any separate debug infos in $debug_root. 390 gdb_test_no_output "set debug-file-directory" 391 gdb_reinitialize_dir $srcdir/$subdir 392 gdb_load $file 393 394 # Print the "PIE (Position Independent Executable) displacement" message. 395 gdb_test_no_output "set verbose on" 396 397 # We want to test the re-run of a PIE in the case where the executable 398 # is loaded with a different displacement, but disable-randomization 399 # prevents that from happening. So turn it off. 400 gdb_test "set disable-randomization off" 401 402 if $ifmain { 403 gdb_test_no_output "set args segv" 404 } else { 405 global binfile_test 406 407 # ld.so needs some executable to run to reach _dl_debug_state. 408 gdb_test_no_output "set args [standard_output_file $binfile_test]" \ 409 "set args OBJDIR/${subdir}/$binfile_test" 410 } 411 412 reach $solib_bp "run" $displacement 1 413 414 with_test_prefix "first backtrace" { 415 gdb_test_no_output "set verbose off" 416 gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" 417 gdb_test_no_output "set verbose on" 418 } 419 420 if $ifmain { 421 reach "main" continue "NONE" 422 423 reach "libfunc" continue "NONE" 424 425 with_test_prefix "second backtrace" { 426 gdb_test_no_output "set verbose off" 427 gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt" 428 gdb_test_no_output "set verbose on" 429 } 430 } 431 432 # Try re-run if the new PIE displacement takes effect. 433 gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y" 434 reach $solib_bp "run" $displacement 2 435 gdb_test_no_output "set verbose off" 436 437 if $ifmain { 438 test_core $file $displacement 439 440 test_attach $file $displacement 441 } 442 443 if !$trynosym { 444 return 445 } 446 447 with_test_prefix "symbol-less" { 448 # Test also `exec-file'-command loaded $FILE - therefore 449 # without symbols. SYMBOL_OBJFILE is not available and only 450 # EXEC_BFD must be used. 451 452 gdb_exit 453 gdb_start 454 # Clear it to never find any separate debug infos in $debug_root. 455 gdb_test_no_output "set debug-file-directory" 456 gdb_reinitialize_dir $srcdir/$subdir 457 458 # Print the "PIE (Position Independent Executable) 459 # displacement" message. 460 gdb_test_no_output "set verbose on" 461 462 # Test no (error) message has been printed by `exec-file'. 463 set escapedfile [string_to_regexp $file] 464 gdb_test "exec-file $file" "exec-file $escapedfile" "load" 465 466 if $ifmain { 467 reach $solib_bp run $displacement 3 468 469 # Use two separate gdb_test_multiple statements to avoid timeouts due 470 # to slow processing of wildcard capturing long output 471 set test "info files" 472 set entrynohex "" 473 set info_line [join [list \ 474 "\r\n" "\[\t\]" "0x\[0-9af\]+" " - " \ 475 "0x\[0-9af\]+" " @ " "0x\[0-9af\]+" \ 476 " is " "\[^\r\n\]+"] ""] 477 gdb_test_multiple $test $test { 478 -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n" { 479 set entrynohex $expect_out(1,string) 480 gdb_test_multiple "" $test { 481 -re "\r\n$gdb_prompt $" { 482 pass $test 483 } 484 -re $info_line { 485 # Avoid timeout with check-read1 486 exp_continue 487 } 488 } 489 } 490 } 491 492 # `info sym' cannot be tested for .opd as the binary may not have 493 # symbols. 494 if {[istarget powerpc64-*] && [is_lp64_target]} { 495 set test "convert entry point" 496 gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test { 497 -re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r\n$gdb_prompt $" { 498 set entrynohex $expect_out(2,string) 499 pass $test 500 } 501 } 502 } 503 if {$entrynohex != ""} { 504 gdb_test "break *0x$entrynohex" "" "break at entry point" 505 gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached" 506 } 507 } else { 508 # There is no symbol to break at ld.so. Moreover it can 509 # exit with an error code. 510 511 set test "ld.so exit" 512 set test_displacement "seen displacement message as $displacement" 513 gdb_test_multiple "run" $test { 514 -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { 515 # Missing "$gdb_prompt $" is intentional. 516 if {$expect_out(1,string) == "0x0"} { 517 set case "ZERO" 518 } else { 519 set case "NONZERO" 520 } 521 if {$displacement == $case || $displacement == "PRESENT"} { 522 pass $test_displacement 523 set displacement "FOUND-$displacement" 524 } else { 525 fail $test_displacement 526 } 527 exp_continue 528 } 529 -re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_prompt $" { 530 # Do not check the binary filename as it may be truncated. 531 pass $test 532 } 533 } 534 if ![regexp {^(NONE|FOUND-.*)$} $displacement] { 535 fail $test_displacement 536 } 537 } 538 gdb_test_no_output "set verbose off" 539 } 540} 541 542# Create separate binaries for each testcase - to make the possible reported 543# problem reproducible after the whole test run finishes. 544 545foreach_with_prefix ldprelink {NO YES} { 546 foreach_with_prefix ldsepdebug {NO IN SEP} { 547 # Skip running the ldsepdebug test if we do not have system separate 548 # debug info available. 549 if {$interp_system_debug == "" && $ldsepdebug == "SEP"} { 550 continue 551 } 552 553 set ldname "LDprelink${ldprelink}debug${ldsepdebug}" 554 set interp $binprefix-$ldname 555 556 # prelink needs to always prelink all the dependencies to do any file 557 # modifications of its files. ld.so also needs all the dependencies to 558 # be prelinked to omit the relocation process. In-memory file offsets 559 # are not dependent whether ld.so went the prelink way or through the 560 # relocation process. 561 # 562 # For GDB we are not interested whether prelink succeeds as it is 563 # transparent to GDB. GDB is being tested for differences of file 564 # offsets vs. in-memory offsets. So we have to prelink even ld.so for 565 # the BIN modification to happen but we need to restore the original 566 # possibly unprelinked ld.so to test all the combinations for GDB. 567 set interp_saved ${interp}-saved 568 569 if {$ldsepdebug == "NO"} { 570 file_copy $interp_system $interp 571 # Never call strip-debug before unprelink: 572 # prelink: ...: Section .note.gnu.build-id created after prelinking 573 if ![prelinkNO $interp] { 574 continue 575 } 576 strip_debug $interp 577 } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} { 578 file_copy $interp_system $interp 579 } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} { 580 file_copy $interp_system $interp 581 file_copy $interp_system_debug "${interp}.debug" 582 # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u 583 if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} { 584 continue 585 } 586 set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]" 587 set command "exec eu-unstrip -o $interp $interp ${interp}.debug" 588 verbose -log "command is $command" 589 if [catch $command] { 590 setup_xfail *-*-* 591 fail $test 592 continue 593 } else { 594 pass $test 595 } 596 } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} { 597 file_copy $interp_system $interp 598 # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u 599 if ![prelinkNO $interp] { 600 continue 601 } 602 gdb_gnu_strip_debug $interp 603 } elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} { 604 file_copy $interp_system $interp 605 file_copy $interp_system_debug "${interp}.debug" 606 } 607 608 if {$ldsepdebug == "SEP"} { 609 if ![prelinkNO "${interp}.debug"] { 610 continue 611 } 612 } else { 613 file delete "${interp}.debug" 614 } 615 616 if ![prelink$ldprelink $interp "[file tail $interp], second time"] { 617 continue 618 } 619 620 if {$ldprelink == "NO"} { 621 set displacement "NONZERO" 622 } else { 623 # x86* kernel loads prelinked PIE binary at its 624 # prelinked address but ppc* kernel loads it at a 625 # random address. prelink normally skips PIE binaries 626 # during the system scan. 627 set displacement "PRESENT" 628 } 629 test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement 630 631 if ![file_copy $interp $interp_saved] { 632 continue 633 } 634 635 foreach_with_prefix binprelink {NO YES} { 636 foreach_with_prefix binsepdebug {NO IN SEP} { 637 # "ATTACH" is like "YES" but it is modified during 638 # run. It cannot be used for problem 639 # reproducibility after the testcase ends. 640 foreach_with_prefix binpie {NO YES ATTACH} { 641 # This combination is not possible, non-PIE (fixed address) 642 # binary cannot be prelinked to any (other) address. 643 if {$binprelink == "YES" && $binpie == "NO"} { 644 continue 645 } 646 647 set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}" 648 set exec $binprefix-$binname 649 650 set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]" 651 if {$binsepdebug != "NO"} { 652 lappend opts {debug} 653 } 654 if {$binpie != "NO"} { 655 lappend opts {pie} 656 } else { 657 # Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled. 658 lappend opts {nopie} 659 } 660 661 set dir ${exec}.d 662 set relink_args [build_executable_own_libs ${test}.exp [file tail $exec] $srcfile $opts $interp $dir] 663 if {$relink_args == ""} { 664 continue 665 } 666 667 if {$binsepdebug == "SEP"} { 668 gdb_gnu_strip_debug $exec 669 } 670 671 if {$binpie == "NO"} { 672 set displacement "NONE" 673 } elseif {$binprelink == "NO"} { 674 set displacement "NONZERO" 675 } else { 676 # x86* kernel loads prelinked PIE binary at its prelinked 677 # address but ppc* kernel loads it at a random address. 678 # prelink normally skips PIE binaries during the system scan. 679 set displacement "PRESENT" 680 } 681 682 if {[prelink$binprelink $relink_args [file tail $exec]] 683 && [file_copy $interp_saved $interp]} { 684 # In order to make test names unique wrap the core of this if block 685 # with a test prefix. Some of the tests performed in the if 686 # condition are repeated within this body. 687 with_test_prefix "INNER" { 688 if {$binpie != "ATTACH"} { 689 test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement 690 } else { 691 # If the file has been randomly prelinked it must be 692 # "NONZERO". We could see "ZERO" only if it was unprelinked 693 # and it is now running at the same address - which is 0 but 694 # executable can never run at address 0. 695 696 set displacement "NONZERO" 697 test_attach $exec $displacement $relink_args 698 699 # ATTACH means that executables and libraries have been 700 # modified after they have been run. They cannot be reused 701 # for problem reproducibility after the testcase ends in 702 # the ATTACH case. Therefore they are rather deleted not 703 # to confuse after the run finishes. 704 set exec_debug [system_debug_get $exec] 705 if {$exec_debug != ""} { 706 # `file delete [glob "${exec_debug}*"]' does not work. 707 foreach f [glob "${exec_debug}*"] { 708 file delete $f 709 } 710 } 711 file delete -force $dir 712 # `file delete [glob "${exec}*"]' does not work. 713 foreach f [glob "${exec}*"] { 714 file delete $f 715 } 716 } 717 } 718 } 719 } 720 } 721 } 722 723 file delete $interp_saved 724 } 725} 726