From: Tom de Vries Date: Wed, 3 Sep 2025 16:20:47 +0000 (+0200) Subject: [gdb/testsuite] Fix clean_restart in gdb.debuginfod X-Git-Tag: gdb-17-branchpoint~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a5c1f8020f73650e04095da33d4c63b6f0aa562;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix clean_restart in gdb.debuginfod Fix clean_restart in the test-cases in gdb.debuginfod. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp index dac4e6c5e58..204b924d02e 100644 --- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp +++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp @@ -69,14 +69,15 @@ standard_testfile -1.c -2.c -3.c # shared library, then use GDB to figure out the offset of the # variable 'library_ptr' within the library. set library_filename [standard_output_file "libfoo.so"] -set binfile2 [standard_output_file "library_loader"] +set testfile2 "library_loader" +set binfile2 [standard_output_file $testfile2] if {[prepare_for_testing_full "build exec which loads the shared library" \ [list $library_filename \ { debug shlib build-id \ additional_flags=-DPOINTER_VALUE=0x12345678 } \ $srcfile2 {}] \ - [list $binfile2 [list debug shlib=$library_filename ] \ + [list $testfile2 [list debug shlib=$library_filename ] \ $srcfile { debug }]] != 0} { return } @@ -160,7 +161,7 @@ if { $ptr_expected_value eq "" } { # Load this executable within GDB and confirm that we can use the # offset we calculated previously to view the value of 'library_ptr'. set opts [list debug additional_flags=-DSHLIB_FILENAME=\"$library_filename\"] -if {[prepare_for_testing "prepare second executable" $binfile \ +if {[prepare_for_testing "prepare second executable" $testfile \ $srcfile3 $opts] != 0} { return } @@ -268,7 +269,7 @@ proc load_core_file { testname { line_re "" } } { # And now restart GDB, load the core-file and check that the library shows as # being mapped in, and that we can still read the library_ptr value from # memory. -clean_restart $binfile +clean_restart $::testfile load_core_file "load core file" @@ -287,7 +288,7 @@ gdb_assert { $ptr_value == $ptr_expected_value } \ set library_backup_filename [standard_output_file "libfoo.so.backup"] remote_exec build "mv \"$library_filename\" \"$library_backup_filename\"" -clean_restart $binfile +clean_restart $::testfile load_core_file "load corefile with library file missing" \ "warning: Can't open file [string_to_regexp $library_filename] during file-backed mapping note processing" @@ -309,7 +310,7 @@ set build_id_filename \ remote_exec build "mkdir -p [file dirname $build_id_filename]" remote_exec build "ln -sf $library_backup_filename $build_id_filename" -clean_restart $binfile +clean_restart $::testfile gdb_test_no_output "set debug-file-directory $debugdir" \ "set debug-file-directory" @@ -331,7 +332,7 @@ if {[build_executable "build second version of shared library" \ return } -clean_restart $binfile +clean_restart $::testfile load_core_file "load corefile with wrong library in place" \ "warning: File [string_to_regexp $library_filename] doesn't match build-id from core-file during file-backed mapping processing" diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index 4b3894e1baa..569519be66a 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -107,7 +107,7 @@ proc_with_prefix no_url { } { setenv DEBUGINFOD_URLS "" # Test that GDB cannot find source without debuginfod. - clean_restart $binfile + clean_restart $::testfile gdb_test_no_output "set substitute-path $outputdir /dev/null" \ "set substitute-path" gdb_test "list" ".*No such file or directory.*" @@ -126,7 +126,7 @@ proc_with_prefix no_url { } { file rename -force $debuginfo $debugdir # Test that GDB cannot find symbols without debuginfod. - clean_restart $binfile + clean_restart $::testfile gdb_test "file" ".*No symbol file.*" set buildid "01234567890abcdef0123456" @@ -157,7 +157,7 @@ proc_with_prefix no_url { } { # Generate a core file and test that GDB cannot find the # executable. - clean_restart ${binfile}2 + clean_restart ${::testfile}2 if ![runto_main] { return -1 } diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp index 1008e462a7f..67d9237d43c 100644 --- a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp +++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp @@ -132,7 +132,7 @@ if {$corefile eq ""} { proc load_exec_and_core_file { expect_warning expect_download testname \ {debugdir ""} } { with_test_prefix $testname { - clean_restart $::binfile + clean_restart $::testfile if { $debugdir ne "" } { gdb_test_no_output "set debug-file-directory $debugdir" \