aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-09-03 11:53:08 +0200
committerTom de Vries <tdevries@suse.de>2025-09-03 11:53:08 +0200
commitc1e9f1454faaa0b66a2b32e17201f4613b9bc0c4 (patch)
treec4efb6601c9c16899620a87c2faa9b963342bd54 /gdb/testsuite
parent98583463abed11c7659028c0d68a9619fed5f559 (diff)
downloadbinutils-c1e9f1454faaa0b66a2b32e17201f4613b9bc0c4.zip
binutils-c1e9f1454faaa0b66a2b32e17201f4613b9bc0c4.tar.gz
binutils-c1e9f1454faaa0b66a2b32e17201f4613b9bc0c4.tar.bz2
[gdb/testsuite] Fix clean_restart <absolute filename> in gdb.python
Fix clean_restart <absolute filename> in the test-cases in gdb.python. Tested on x86_64-linux.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.exp.tcl10
-rw-r--r--gdb/testsuite/gdb.python/py-exec-file.exp8
-rw-r--r--gdb/testsuite/gdb.python/py-format-address.exp8
-rw-r--r--gdb/testsuite/gdb.python/py-format-string.exp3
-rw-r--r--gdb/testsuite/gdb.python/py-framefilter-mi.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-objfile.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-mi.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-objfile.exp3
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp5
-rw-r--r--gdb/testsuite/gdb.python/py-source-styling.exp6
-rw-r--r--gdb/testsuite/gdb.python/py-symbol.exp10
-rw-r--r--gdb/testsuite/gdb.python/py-thrhandle.exp2
-rw-r--r--gdb/testsuite/gdb.python/py-type.exp3
-rw-r--r--gdb/testsuite/gdb.python/py-value.exp5
-rw-r--r--gdb/testsuite/gdb.python/py-varobj.exp2
18 files changed, 46 insertions, 33 deletions
diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
index dd6cb59..17b8afe 100644
--- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
+++ b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.python/py-disasm.exp.tcl b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
index c5099ba..5f45747 100644
--- a/gdb/testsuite/gdb.python/py-disasm.exp.tcl
+++ b/gdb/testsuite/gdb.python/py-disasm.exp.tcl
@@ -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 {
diff --git a/gdb/testsuite/gdb.python/py-exec-file.exp b/gdb/testsuite/gdb.python/py-exec-file.exp
index b3418a5..139ce83 100644
--- a/gdb/testsuite/gdb.python/py-exec-file.exp
+++ b/gdb/testsuite/gdb.python/py-exec-file.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp
index 173297c..dd35627 100644
--- a/gdb/testsuite/gdb.python/py-format-address.exp
+++ b/gdb/testsuite/gdb.python/py-format-address.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 2463185..8f38c18 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-framefilter-mi.exp b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
index de04236..03e5f90 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-mi.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-mi.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.python/py-mi-objfile.exp b/gdb/testsuite/gdb.python/py-mi-objfile.exp
index 58ecbc5..39bac2b 100644
--- a/gdb/testsuite/gdb.python/py-mi-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-mi-objfile.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
index 07cd40f..7a9124b 100644
--- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
+++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
@@ -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}" \
diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index 7f1dffc..28d63c1 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index 29bc555..ce4dc76 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 8d11028..befdb91 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -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"
}
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 0b5ca9a..c342d45 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp
index 308053c..5d79356 100644
--- a/gdb/testsuite/gdb.python/py-source-styling.exp
+++ b/gdb/testsuite/gdb.python/py-source-styling.exp
@@ -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.
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index dfc435e..2029c28 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.python/py-thrhandle.exp b/gdb/testsuite/gdb.python/py-thrhandle.exp
index 343bf4b..a959044 100644
--- a/gdb/testsuite/gdb.python/py-thrhandle.exp
+++ b/gdb/testsuite/gdb.python/py-thrhandle.exp
@@ -29,7 +29,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index 0bc4556..5472482 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index 93985a9..4857937 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -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
diff --git a/gdb/testsuite/gdb.python/py-varobj.exp b/gdb/testsuite/gdb.python/py-varobj.exp
index 7fb45f9..cf6a662 100644
--- a/gdb/testsuite/gdb.python/py-varobj.exp
+++ b/gdb/testsuite/gdb.python/py-varobj.exp
@@ -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}" \