]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.base, part 2
authorTom de Vries <tdevries@suse.de>
Fri, 5 Sep 2025 13:36:23 +0000 (15:36 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 5 Sep 2025 13:36:23 +0000 (15:36 +0200)
Manually fix the test-cases found by:
...
$ find gdb/testsuite/gdb.base -name *.exp* \
  | xargs grep -l 'clean_restart[^;]*binfile'
$ find gdb/testsuite/gdb.base -name *.exp* \
  | xargs grep -l 'prepare_for_testing.*bin'
...
except for gdb.base/foll-vfork.exp and gdb.base/solib-overlap.exp.

Tested on x86_64-linux.

31 files changed:
gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
gdb/testsuite/gdb.base/bp-cond-failure.exp
gdb/testsuite/gdb.base/break-fun-addr.exp
gdb/testsuite/gdb.base/break-idempotent.exp
gdb/testsuite/gdb.base/call-sc.exp
gdb/testsuite/gdb.base/cli-suppress-notification.exp
gdb/testsuite/gdb.base/condbreak-bad.exp
gdb/testsuite/gdb.base/cvexpr.exp
gdb/testsuite/gdb.base/detach-sysroot-target.exp
gdb/testsuite/gdb.base/foll-exec.exp.tcl
gdb/testsuite/gdb.base/gcore-relro-pie.exp
gdb/testsuite/gdb.base/gcore-tls-pie.exp
gdb/testsuite/gdb.base/gdb-index-err.exp
gdb/testsuite/gdb.base/gnu-ifunc.exp
gdb/testsuite/gdb.base/info-program.exp
gdb/testsuite/gdb.base/jit-bfd-name.exp
gdb/testsuite/gdb.base/jit-elf-fork.exp
gdb/testsuite/gdb.base/jit-elf-so.exp
gdb/testsuite/gdb.base/jit-elf.exp
gdb/testsuite/gdb.base/jit-reader-simple.exp
gdb/testsuite/gdb.base/macro-source-path.exp
gdb/testsuite/gdb.base/max-depth.exp.tcl
gdb/testsuite/gdb.base/readnever.exp
gdb/testsuite/gdb.base/rtld-step.exp
gdb/testsuite/gdb.base/skip.exp
gdb/testsuite/gdb.base/structs.exp
gdb/testsuite/gdb.base/structs2.exp
gdb/testsuite/gdb.base/style.exp
gdb/testsuite/gdb.base/sym-file.exp
gdb/testsuite/gdb.base/testenv.exp
gdb/testsuite/gdb.base/tls-nothreads.exp

index fce6d679b898ae249cac86fcd8d3d3458091d8b6..5f5432ca9c0d7004760c632cc1dc5768e26b3c81 100644 (file)
@@ -52,7 +52,8 @@ proc prepare_test {has_cfi} {
        return false
     }
 
-    clean_restart "$binfile-${extension}"
+    clean_restart
+    gdb_load $binfile-$extension
 
     if ![runto callback] then {
        fail "has_cfi=$has_cfi: Can't run to callback"
index 53885227c70773db97e809b22b76517d5bdeb107..f33092b5132a4787fa7dfe0e87c54b69f5d0bdf6 100644 (file)
@@ -26,7 +26,7 @@
 
 standard_testfile
 
-if { [prepare_for_testing "failed to prepare" ${binfile} "${srcfile}" \
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
          {debug c++}] == -1 } {
     return
 }
index 9f5325ad8a9ffe450c4cd2c8fabf9df37b4406b5..ba6e32e9df71dd9b5dceb082b06635ef85c5db0e 100644 (file)
@@ -44,7 +44,8 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {d
 # on the first instruction of function "main" ("*main"), then
 # run to that breakpoint.
 
-clean_restart ${binfile1}
+clean_restart
+gdb_load $binfile1
 
 with_test_prefix "${testfile1}" {
 
index ed23b64d0a984292fdcf6412408effdaac3831d3..3b32c89772d7be7590c64f00be9b2f6984cc0ab2 100644 (file)
@@ -161,7 +161,7 @@ foreach_with_prefix pie { "nopie" "pie" } {
 
     set binfile [standard_output_file $testfile-$pie]
 
-    if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
+    if {[prepare_for_testing "failed to prepare" $testfile-$pie $srcfile $opts]} {
        continue
     }
 
index 4d0fccc2f5c95bb7ffe4756cf4a6e031138c6723..f67670dccc5b673ac3eb57cff73c9ae31a23b476 100644 (file)
@@ -46,7 +46,7 @@ proc start_scalars_test { type } {
     set testfile "call-sc-${type}"
 
     set binfile [standard_output_file ${testfile}]
-    if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+    if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
        return -1
     }
 
index 19f9c558e450bed490b7a35ae42ed4fea294863f..6880d983a4d9a3ae88f6f3e9e368103b5d8d32dd 100644 (file)
@@ -17,7 +17,7 @@
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return
 }
 
index 7aff409a31eabf938e5a85e3b6b637288965c229..19c16dc3c520b02b2e2eff3efd1b87fe97067161 100644 (file)
@@ -17,7 +17,7 @@
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return
 }
 
index 3e527dbe8254f14f27c5e7bee5e7b5fbab0be38d..e2f8c357a135e13795c26f407c2291be486e6eab 100644 (file)
@@ -517,7 +517,7 @@ foreach testspec $specs {
 
 # These tests don't rely on the debug format.
 with_test_prefix nodebug {
-    if { [prepare_for_testing "failed to prepare" $binfile $srcfile {nodebug}] } {
+    if { [prepare_for_testing "failed to prepare" $testfile $srcfile {nodebug}] } {
        return 0
     }
 
index 4248c8688a3400fb0537229c10dc305c3cf17363..c7466c04f75d7e3311dcc80b4547ccf340aa5e3d 100644 (file)
@@ -22,7 +22,7 @@
 
 standard_testfile
 
-if {[prepare_for_testing "failed to prepare" ${binfile} ${srcfile}]} {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return
 }
 
index 8f96a55fda468ac0926f2c5dc1b9364cb12e8f6b..64bcea857f8733cfa51da0894f1845eef46724a2 100644 (file)
@@ -68,7 +68,8 @@ proc do_exec_tests { execer_lang execee_lang } {
    }
 
    # Now we can start running the tests.
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    if {![runto_main]} {
@@ -93,7 +94,8 @@ proc do_exec_tests { execer_lang execee_lang } {
      return
    }
 
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    #
@@ -182,7 +184,8 @@ proc do_exec_tests { execer_lang execee_lang } {
 
    # Explicitly kill this program, or a subsequent rerun actually runs
    # the exec'd program, not the original program...
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    #
@@ -250,7 +253,8 @@ proc do_exec_tests { execer_lang execee_lang } {
 
    # Explicitly kill this program, or a subsequent rerun actually runs
    # the exec'd program, not the original program...
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    #
@@ -317,7 +321,8 @@ proc do_exec_tests { execer_lang execee_lang } {
 
    # Explicitly kill this program, or a subsequent rerun actually runs
    # the exec'd program, not the original program...
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    #
@@ -378,7 +383,8 @@ proc do_exec_tests { execer_lang execee_lang } {
 
    # Explicitly kill this program, or a subsequent rerun actually runs
    # the exec'd program, not the original program...
-   clean_restart $execer_binfile
+   clean_restart
+   gdb_load $execer_binfile
 
    # Start the program running, and stop at main.
    #
index 1f27a0b50797fb2ce2ec188e3a3970fea7b2679a..641caf1b798647802fed4478443d2c3f628d1bec 100644 (file)
@@ -38,7 +38,8 @@ if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
 set perm [file attributes ${binfile} -permissions]
 file attributes ${stripped_binfile} -permissions $perm
 
-clean_restart ${stripped_binfile}
+clean_restart
+gdb_load $stripped_binfile
 
 # The binary is stripped of debug info, but not minsyms.
 if ![runto break_here] {
index 1ad9b5547b18170b1d7265cdbf3943a26c26b60d..a8f7366c7a1ab631669a72dfda97f1e3840bf60c 100644 (file)
@@ -42,7 +42,8 @@ if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
 set perm [file attributes ${binfile} -permissions]
 file attributes ${stripped_binfile} -permissions $perm
 
-clean_restart ${stripped_binfile}
+clean_restart
+gdb_load $stripped_binfile
 
 # The binary is stripped of debug info, but not minsyms.
 if ![runto break_here] {
index 973248ad8f66f2327d9dba74ee80983403f70321..b35383649b716c2c9919909e70462724c342bf4e 100644 (file)
@@ -90,13 +90,15 @@ foreach_with_prefix flag { "" "-dwarf-5" } {
     }
 
     # Add the index section to the executable.
-    clean_restart ${binfile}.${extension}
+    clean_restart
+    gdb_load $binfile.$extension
     gdb_assert {[ensure_gdb_index ${binfile}.${extension} ${flag}] == 1} \
        "add index to executable"
 
     # Reload the executable (which now has an index), and try to
     # generate and index from it.  This will fail.
-    clean_restart ${binfile}.${extension}
+    clean_restart
+    gdb_load $binfile.$extension
     gdb_test "save gdb-index ${flag} $already_indexed_dir" \
        "Error while writing index for `[string_to_regexp $binfile.$extension]': Cannot use an index to create the index" \
        "try to generate an index from a binary with an index"
index 20a099734251b65e7582952bf28972eaa537977b..f134a0f1d9b3baf76cb2da038d851bd9fb29b40e 100644 (file)
@@ -96,7 +96,8 @@ proc_with_prefix set-break {resolver_attr resolver_debug final_debug} {
     set suffix [make_binsuffix $resolver_attr $resolver_debug $final_debug]
 
     set lib_so [standard_output_file ${libfile}-$suffix.so]
-    clean_restart $binfile-$suffix
+    clean_restart
+    gdb_load $binfile-$suffix
     gdb_load_shlib ${lib_so}
 
     if {![runto_main]} {
@@ -223,7 +224,8 @@ proc misc_tests {resolver_attr resolver_debug final_debug} {
 
     # Start with a fresh gdb.
 
-    clean_restart $binfile-$suffix
+    clean_restart
+    gdb_load $binfile-$suffix
     gdb_load_shlib ${lib_so}
 
     if {![runto_main]} {
index 5a47e1e8cf1c2c31ad6737c75d1a9de4cc2702c8..da24880c2e992f4950b603ad01e292058553c195 100644 (file)
@@ -35,7 +35,8 @@ standard_testfile
 proc do_test { threads non-stop } {
     save_vars { ::GDBFLAGS } {
        append ::GDBFLAGS " -ex \"set non-stop ${non-stop}\""
-       clean_restart $::binfile-$threads
+       clean_restart
+       gdb_load $::binfile-$threads
     }
 
     gdb_test "info program" \
index 219929b3f2f9efdc9618cc5ceb05b16da2014456..756a38b00f4e93c1428479b35ae58b599f9417b9 100644 (file)
@@ -46,7 +46,8 @@ if { [compile_jit_main ${main_srcfile} ${main_binfile} {}] != 0 } {
     return
 }
 
-clean_restart $::main_binfile
+clean_restart
+gdb_load $::main_binfile
 if { ![runto_main] } {
     return
 }
index c1fa42833625fdd3e1f5a803f26803290a2fab84..92e7dc679717c3e04468b2f3e9b057fe401073e2 100644 (file)
@@ -54,7 +54,8 @@ if { [compile_jit_main ${main_srcfile} ${main_binfile} {}] != 0 } {
 # that the callers can continue execution until there.
 
 proc do_setup { detach-on-fork follow-fork-mode } {
-       clean_restart ${::main_binfile}
+       clean_restart
+       gdb_load $::main_binfile
 
        gdb_test_no_output "set detach-on-fork ${detach-on-fork}"
        gdb_test_no_output "set follow-fork-mode ${follow-fork-mode}"
index c227748f03e240daec8a2d338417671bc583f13d..8f16bdb9623ab7ee42f6b83e0759eda60d62613d 100644 (file)
@@ -73,7 +73,8 @@ proc one_jit_test {solib_binfiles_target match_str} {
        global main_loader_binfile main_loader_srcfile
        global main_solib_binfile main_solib_binfile_target main_solib_srcfile
 
-       clean_restart $main_loader_binfile
+       clean_restart
+       gdb_load $main_loader_binfile
        gdb_locate_shlib $main_solib_binfile
 
        # This is just to help debugging when things fail
index a519565ea4c5ca19aeda3a0a91814bffb31fc20f..2dc67a517be10e6a631c01fb29bce111ad4303fd 100644 (file)
@@ -48,7 +48,8 @@ proc clean_reattach {} {
     gdb_test_no_output "set var wait_for_gdb = 1"
     gdb_test "detach" "Detaching from .*"
 
-    clean_restart ${main_binfile}
+    clean_restart
+    gdb_load $main_binfile
 
     if { ![gdb_attach $testpid \
              -pattern "main.*at .*$::main_basename.c:.*"] } {
@@ -84,7 +85,8 @@ proc one_jit_test {jit_solibs_target match_str reattach} {
        global test_verbose
        global main_binfile main_srcfile
 
-       clean_restart ${main_binfile}
+       clean_restart
+       gdb_load $main_binfile
 
        # This is just to help debugging when things fail
        if {$test_verbose > 0} {
index 55a274c08a6f0e12f822d83017149945c590a81c..f577dba31b9c6eb4883d9486570cf0fe88507467 100644 (file)
@@ -106,7 +106,8 @@ proc jit_test_reread {standalone change_addr} {
            clean_restart
            gdb_load $binfile
        } else {
-           clean_restart $binfile_dl
+           clean_restart
+           gdb_load $binfile_dl
        }
 
        runto_main
@@ -176,7 +177,8 @@ foreach standalone {1 0} {
 # see JIT breakpoints defined for both.
 
 with_test_prefix "two JITers" {
-    clean_restart $binfile_dl2
+    clean_restart
+    gdb_load $binfile_dl2
 
     if {![runto_main]} {
        return -1
index 47d99aab06a8e23d0683094b1448af87d7076322..9c842279df23ab8e9e47c33ad19543b7e4a3baeb 100644 (file)
@@ -53,7 +53,8 @@ proc test { src name } {
            return
        }
 
-       clean_restart [host_file_normalize $binfile]
+       clean_restart
+       gdb_load [host_file_normalize $binfile]
 
        if { ![runto_main] } {
            return
index fcec47b3be06c05709b0e156cd617929f0cf9903..a57e3ccd206b970ca0e6858e9777ce32b8ac007e 100644 (file)
@@ -30,7 +30,7 @@ proc compile_and_run_tests { lang } {
        lappend flags "additional_flags=-std=c++11"
     }
 
-    if { [prepare_for_testing "failed to prepare" "${binfile}" "${srcfile}" "${flags}"] } {
+    if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
        return 0
     }
 
index 6dfd57658b1cd65849d4092be9def18a8c163f7b..891adf53a540859496d7f2dd33a343dbbe2379a3 100644 (file)
@@ -26,7 +26,7 @@ if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
 
 save_vars { GDBFLAGS } {
     append GDBFLAGS " --readnever"
-    if { [clean_restart ${binfile}] == -1 } {
+    if { [clean_restart $testfile] == -1 } {
        return -1
     }
 }
index 242cd477768c028dcd0c77b3cfec4de663c6c5d0..d1e240b07a7f8bfa0f15e9ee673bff2cc2c824c9 100644 (file)
@@ -114,7 +114,8 @@ if { [gdb_compile ${srcfile_main} ${binfile_main} executable $main_flags] != ""
     return -1
 }
 
-clean_restart ${binfile_main}
+clean_restart
+gdb_load $binfile_main
 
 if {![runto_main]} {
     return 0
index 016e5eb0bef7b60273c55ac6db24e0a6b10bd4a0..0c84cf90127ac9a62dd2b732e5bcbd302ac615d9 100644 (file)
@@ -309,7 +309,8 @@ with_test_prefix "step using -fi + -fu" {
 
 with_test_prefix "skip delete completion" {
     global binfile
-    clean_restart "${binfile}"
+    clean_restart
+    gdb_load $binfile
     if ![runto_main] {
        return
     }
index 31a45b521e464a71e7bf7903a76c9ba69bc434db..fa7f7867b9fdcdbe7b663ae5398a98982e8c4875 100644 (file)
@@ -56,7 +56,7 @@ proc start_structs_test { types } {
     }
 
     set binfile [standard_output_file ${testfile}]
-    if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+    if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } {
        return -1
     }
 
index 8ccd50dbaf4319719eb0d377ef00ab6f8581dbe0..f377022cc212e38481ad7c3ed32af04db491caaf 100644 (file)
@@ -15,7 +15,7 @@
 
 standard_testfile .c
 
-if { [prepare_for_testing "failed to prepare" $binfile $srcfile {debug}] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
     return -1
 }
 
index 3dde79af323c5c8b2f2d846e1c181af87f6b56d5..6ab16ca9e01abb9eb0ed413c313c1b4936c68586 100644 (file)
@@ -77,7 +77,7 @@ proc run_style_tests { } {
 
        # Restart GDB with the correct TERM variable setting, this
        # means that GDB will enable styling.
-       clean_restart_and_disable "restart 1" ${binfile}
+       clean_restart_and_disable "restart 1" $::testfile
 
        set readnow [readnow]
 
@@ -358,7 +358,7 @@ proc test_disable_disassembler_styling { } {
 
        # Restart GDB with the correct TERM variable setting, this
        # means that GDB will enable styling.
-       clean_restart_and_disable "restart 3" $::binfile
+       clean_restart_and_disable "restart 3" $::testfile
 
        set styled_hex [limited_style $::hex address]
        set main [limited_style main function]
@@ -473,7 +473,7 @@ proc test_disassembler_error_handling { } {
 
        # Restart GDB with the correct TERM variable setting, this
        # means that GDB will enable styling.
-       clean_restart_and_disable "restart 4" $::binfile
+       clean_restart_and_disable "restart 4" $::testfile
 
        # Disable use of libopcodes for styling.  As this function is
        # only called when Python Pygments module is available, we
index 6570fdb7a3b461ea0804f7246c9f2ee593a21adf..13febdac2dbd134803661f6c33af9c67a5002b78 100644 (file)
@@ -61,7 +61,8 @@ if {[gdb_compile_shlib $libsrc $lib_so {debug}] != ""} {
     return
 }
 
-if {[prepare_for_testing "failed to prepare"  $binfile "$srcfile $srcfile2" $exec_opts]} {
+if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
+         $exec_opts] } {
     return
 }
 
index fb7a584bd464599681d03e287152cd2fa5c7ee94..59cd33c527b4d4f1123ca71d8ca00aa713ede1d5 100644 (file)
@@ -27,7 +27,7 @@ standard_testfile .c
 # Compile binary
 # and start with a fresh gdb
 
-if { [prepare_for_testing "failed to prepare" ${binfile} ${srcfile}] } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
      return -1
 }
 
index 0be78a2b6f5a3165a8ab785891a30ef1715ad6e2..c7b147616dec8b1dcf180d72f5ab1e27dfe51586 100644 (file)
@@ -106,7 +106,8 @@ proc do_tests {force_internal_tls {do_kfail_tls_access 0}} {
        set objcopy [gdb_find_objcopy]
        set cmd "$objcopy --strip-debug ${::binfile} $binfile_stripped"
        if ![catch "exec $cmd" cmd_output] {
-           clean_restart $binfile_stripped
+           clean_restart
+           gdb_load $binfile_stripped
            if ![runto_main] {
                return
            }