]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.python
authorTom de Vries <tdevries@suse.de>
Wed, 3 Sep 2025 09:53:08 +0000 (11:53 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 3 Sep 2025 09:53:08 +0000 (11:53 +0200)
Fix clean_restart <absolute filename> in the test-cases in gdb.python.

Tested on x86_64-linux.

18 files changed:
gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
gdb/testsuite/gdb.python/py-disasm.exp.tcl
gdb/testsuite/gdb.python/py-exec-file.exp
gdb/testsuite/gdb.python/py-format-address.exp
gdb/testsuite/gdb.python/py-format-string.exp
gdb/testsuite/gdb.python/py-framefilter-mi.exp
gdb/testsuite/gdb.python/py-mi-objfile.exp
gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
gdb/testsuite/gdb.python/py-mi.exp
gdb/testsuite/gdb.python/py-missing-objfile.exp
gdb/testsuite/gdb.python/py-objfile.exp
gdb/testsuite/gdb.python/py-prettyprint.exp
gdb/testsuite/gdb.python/py-source-styling.exp
gdb/testsuite/gdb.python/py-symbol.exp
gdb/testsuite/gdb.python/py-thrhandle.exp
gdb/testsuite/gdb.python/py-type.exp
gdb/testsuite/gdb.python/py-value.exp
gdb/testsuite/gdb.python/py-varobj.exp

index dd6cb595a8d4a5dc3c8a3422e26d1f43946cbeb0..17b8afe8a13dcb96da94c1e4703c9aa7b61fa31a 100644 (file)
@@ -39,7 +39,7 @@ proc start_test { breakpoint_comment } {
     # Start with a fresh gdb.
     # This is important because the test can crash GDB.
 
-    clean_restart ${binfile}
+    clean_restart ${::testfile}
 
     if {![runto_main]} {
        untested "couldn't run to breakpoint"
index c5099bac22cfdad8466b71aae6ba17fa956156e4..5f4574702e70e205eddd5947a82e5aad4be8554f 100644 (file)
@@ -24,14 +24,16 @@ standard_testfile py-disasm.c
 
 if { $kind == "obj" } {
 
-    set obj [standard_output_file ${gdb_test_file_name}.o]
+    set testfile $testfile.o
+    set binfile [standard_output_file $testfile]
 
-    if { [gdb_compile "$srcdir/$subdir/$srcfile" $obj object "debug"] != "" } {
-       untested "failed to compile object file [file tail $obj]"
+    if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile object \
+             "debug"] != "" } {
+       untested "failed to compile object file $testfile"
        return -1
     }
 
-    clean_restart $obj
+    clean_restart $testfile
 
 } else {
 
index b3418a591152e5c87f517e42b6dcb0165c45e5d1..139ce8324f31e66eabfae20a0fedb5b7e2e85730 100644 (file)
@@ -19,8 +19,10 @@ load_lib gdb-python.exp
 
 standard_testfile
 
-set binfile1 ${binfile}-a
-set binfile2 ${binfile}-b
+set testfile1 $testfile-a
+set binfile1 [standard_output_file $testfile1]
+set testfile2 $testfile-b
+set binfile2 [standard_output_file $testfile2]
 
 if {[build_executable "failed to prepare first executable" \
         $binfile1 $srcfile]} {
@@ -176,7 +178,7 @@ with_test_prefix "using 'symbol-file' command" {
 
 # Check the executable_changed event when the executable changes on disk.
 with_test_prefix "exec changes on disk" {
-    clean_restart $binfile1
+    clean_restart $::testfile1
 
     setup_exec_change_handler
 
index 173297c80ee0d70d9f2b1a256e96bafcc2cc8b1c..dd35627b57322f6d142a025d3498a6f77dfcb114 100644 (file)
@@ -27,10 +27,12 @@ foreach func_name { foo bar } {
     }
 }
 
-set binary_foo [standard_output_file "${testfile}-foo"]
-set binary_bar [standard_output_file "${testfile}-bar"]
+set testfile_foo $testfile-foo
+set testfile_bar $testfile-bar
+set binary_foo [standard_output_file $testfile_foo]
+set binary_bar [standard_output_file $testfile_bar]
 
-clean_restart $binary_foo
+clean_restart $testfile_foo
 
 if ![runto_main] {
    return -1
index 2463185aab4cdbee68dac354a7e042981c6e5e67..8f38c182bc3fb22597fb0fa244b37f06640250ed 100644 (file)
@@ -47,7 +47,8 @@ proc build_inferior {exefile lang} {
 proc prepare_gdb {exefile} {
   global srcdir subdir srcfile testfile hex
 
-  clean_restart $exefile
+  clean_restart
+  gdb_load $exefile
 
   if {![runto_main]} {
       return
index de042364595c9e3e00bed2d2999dfa70971f65aa..03e5f90580c9a872849cb6f1ce781b56f37bbb8b 100644 (file)
@@ -28,7 +28,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     return -1
 }
 
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
     return
 }
 
index 58ecbc5519abd1597857c0df26d6288aae4cdff6..39bac2b8fc9a3774b843a7f17ee1db7a554f54af 100644 (file)
@@ -33,7 +33,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 # gdb will find it.
 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}]
 
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
     return
 }
 
index 07cd40fe53e5a2254e21a7a82983268b2f95078a..7a9124b4ca38d6a89590468e735f143e0931cbbf 100644 (file)
@@ -29,7 +29,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" }
     return -1
 }
 
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 mi_gdb_test "source ${pyfile}" \
index 7f1dffc74b37c4326943ecd40457092ab0d56715..28d63c1c2c71f367287f21e0d2d3dcef2af985e3 100644 (file)
@@ -26,7 +26,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
     return -1
 }
 
-if {[mi_clean_restart $binfile]} {
+if {[mi_clean_restart $::testfile]} {
     return
 }
 
@@ -345,7 +345,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \
     return -1
 }
 
-if {[mi_clean_restart ${binfile}-cxx]} {
+if {[mi_clean_restart ${::testfile}-cxx]} {
     return
 }
 
index 29bc555d88fa77bbcaa4130396cfc152e6a99aa8..ce4dc76b71e5597a67584daec2370fd3980d2428 100644 (file)
@@ -134,7 +134,7 @@ proc clean_restart_load_python {} {
 # For sanity, lets check that we can load the specify the executable
 # and then load the core-file the easy way.
 with_test_prefix "initial sanity check" {
-    clean_restart $binfile
+    clean_restart $::testfile
     load_core_file
     check_loaded_debug true true
 }
index 8d1102896fa7d96cb43756faac6680b3845b16b3..befdb9116ec6650b7d9846b60ba1b1cf526075c1 100644 (file)
@@ -163,7 +163,8 @@ if ![ishost *-*-mingw*] {
     remote_exec host "rm -f ${symlink_binary}"
     remote_exec host "ln -sf ${testfile} ${symlink_binary}"
     if [remote_file host exists "${symlink_binary}"] {
-       clean_restart "${symlink_binary}"
+       clean_restart
+       gdb_load "${symlink_binary}"
        gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
            "${testfile}" "gdb.lookup_objfile of symlinked binary"
     }
index 0b5ca9ae34265548eb0bf6c33d9ca835568203bb..c342d453a9a8118fbc28971e958a1d74ded610ce 100644 (file)
@@ -36,7 +36,8 @@ proc run_lang_tests {exefile lang} {
     set nl "\[\r\n\]+"
 
     # Start with a fresh gdb.
-    clean_restart $exefile
+    clean_restart
+    gdb_load $exefile
 
     if {![runto_main]} {
        return
@@ -192,7 +193,7 @@ with_test_prefix c++ {
 
 # Run various other tests.
 
-clean_restart $binfile
+clean_restart $::testfile
 
 if {![runto_main]} {
     return
index 308053c480a7e59d82e92c5a5d9d0808a2e5bf97..5d7935629a5739b5418c8f56a9bc905bef7d826e 100644 (file)
@@ -62,7 +62,7 @@ proc check_source_listing_styling { cmd expect_styled { testname "" } } {
 # highlighting when GNU source highlight is not available (or is
 # disabled, as is done in this test).
 proc test_pygments_styling {} {
-    clean_restart $::binfile
+    clean_restart $::testfile
 
     # Remote host boards disable styling via GDB's command line.  Turn
     # it back on now.
@@ -91,7 +91,7 @@ proc test_pygments_styling {} {
 # string, then set the correct host encoding, and try again.  This
 # time the conversion should succeed.
 proc test_gdb_execute_non_utf8_source {} {
-    clean_restart $::binfile
+    clean_restart $::testfile
 
     # The default host charset is utf-8, the source code contains a
     # non-utf-8 character, so this will fail.
@@ -117,7 +117,7 @@ proc test_gdb_execute_non_utf8_source {} {
 # output to be returned via a string, and in other cases we ask for
 # the output to be sent straight to stdout.
 proc_with_prefix test_source_cache_style_tracking {} {
-    clean_restart $::binfile
+    clean_restart $::testfile
 
     # Remote host boards disable styling via GDB's command line.  Turn
     # it back on now.
index dfc435e7a3dade5e01ab35c30db838b3db8abffc..2029c286599f116a78380fe87bceea3c05ae1469 100644 (file)
@@ -44,7 +44,7 @@ if {!$readnow_p} {
 }
 
 # Restart so we don't have expanded symtabs after the previous test.
-clean_restart ${binfile}
+clean_restart ${::testfile}
 
 # Test looking up a global symbol before we runto_main as this is the
 # point where we don't have a current frame, and we don't want to
@@ -214,8 +214,10 @@ gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "get symtab"
 # C++ tests
 # Recompile binary.
 lappend opts c++
-if {[prepare_for_testing "failed to prepare" "${binfile}-cxx" \
-        [list $srcfile $srcfile2] $opts]} {
+set testfile $testfile-cxx
+set binfile [standard_output_file $testfile]
+if { [prepare_for_testing "failed to prepare" $testfile \
+         [list $srcfile $srcfile2] $opts] } {
     return -1
 }
 
@@ -251,7 +253,7 @@ gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "t
 # Test is_valid when the objfile is unloaded.  This must be the last
 # test as it unloads the object file in GDB.
 # Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
 if {![runto_main]} {
     return 0
 }
index 343bf4b46c3a20a9bacf7955514d6bc6a9fa5a05..a9590443dca79e01faedfbc3f08dea9ed7d214bb 100644 (file)
@@ -29,7 +29,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
     return -1
 }
 
-clean_restart ${binfile}
+clean_restart ${::testfile}
 
 runto_main
 
index 0bc4556c653580a7a519aa64a477acbc33ff0abc..5472482717d9164e3fa1086670266d0601952cd7 100644 (file)
@@ -34,7 +34,8 @@ proc build_inferior {exefile lang} {
 
 # Restart GDB.
 proc restart_gdb {exefile} { 
-  clean_restart $exefile
+  clean_restart
+  gdb_load $exefile
 
   if {![runto_main]} {
       return
index 93985a99a0cdc85535ddeea463953587fe43d95b..4857937836a02576f213b541415ff8ab032b8916 100644 (file)
@@ -431,7 +431,8 @@ proc test_value_after_death {} {
 
 proc test_subscript_regression {exefile lang} {
  # Start with a fresh gdb.
- clean_restart ${exefile}
+  clean_restart
+  gdb_load $exefile
 
  if {![runto_main]} {
      return
@@ -768,7 +769,7 @@ if { [build_inferior "${binfile}" "c"] < 0 } {
 }
 
 # Start with a fresh gdb.
-clean_restart ${binfile}
+clean_restart ${::testfile}
 
 test_history_count
 test_value_creation
index 7fb45f93bd4e33699926a778bd82a7df925d59c7..cf6a66207734b8736790652d33f826f448c0cd78 100644 (file)
@@ -25,7 +25,7 @@ if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != ""}
     return -1
 }
 
-mi_clean_restart $binfile
+mi_clean_restart $::testfile
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 mi_gdb_test "source ${pyfile}" \