Fix clean_restart <absolute filename> in the test-cases in gdb.dwarf2.
Tested on x86_64-linux using gcc-14.
Tested these test-cases on x86_64-linux with target board unix/-m32:
- gdb.dwarf2/valop.exp
- gdb.dwarf2/callframecfa.exp
- gdb.dwarf2/implptr.exp
- gdb.dwarf2/watch-notconst.exp
- gdb.dwarf2/pieces.exp
- gdb.dwarf2/pieces-optimized-out.exp
Tested these test-cases on x86_64-linux with target board fission-dwp:
- gdb.dwarf2/dwp-symlink.exp
- gdb.dwarf2/dwp-sepdebug.exp
Tested test-case gdb.dwarf2/gdb-index-tilde.exp on x86_64-linux by disabling a
too strict home directory check, see PR testsuite/33364.
}
}
-if { [prepare_for_testing "failed to prepare" $binfile [list $asm_file $srcfile ]] } {
+if { [prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile ]] } {
return -1
}
proc run_test { goto_main } {
global binfile decimal hex
- clean_restart ${binfile}
+ clean_restart ${::testfile}
if { $goto_main } {
if ![runto_main] {
# through. This is checking that the is-stmt marked lines are
# displayed differently (without addresses) to addresses that are
# mid-way through a line, or not marked as is-stmt.
-clean_restart $binfile
+clean_restart $::testfile
runto_main
foreach entry $locs {
# Restart the test. This time, stop at a location we know is marked
# as a statement.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
gdb_breakpoint "*line_label_3"
# Restart the test, this time, step through line by line, ensure we
# only stop at the places where is-stmt is true.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
# Get the values of the labels where we expect to stop.
# Now restart the test, and place a breakpoint by line number. GDB
# should select the location that is marked as is-stmt.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
set linum [gdb_get_line_number "main, set var to 0"]
gdb_breakpoint "$srcfile:$linum"
# Restart the test again, this time we will test stepping by
# instruction.
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto_main
# We will be at line_label_1 at this point - we already tested this
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test "ptype a" "type = class sp1::A .*"
proc do_console_test {} {
global binfile
- clean_restart $binfile
+ clean_restart $::testfile
with_test_prefix "console" {
gdb_test_no_output "set print object on"
global binfile
with_test_prefix "mi" {
- if {[mi_clean_restart $binfile]} {
+ if {[mi_clean_restart $::testfile]} {
return
}
gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
with_test_prefix "ignore-prologue-end" {
- clean_restart $binfile
+ clean_restart $::testfile
gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
if ![runto_main] {
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS --readnow"
- clean_restart ${binfile}
+ clean_restart ${::testfile}
}
with_test_prefix "readnow" {
# Test for presence of complaint, with the lib relocated.
proc_with_prefix test_relocated { exec_path lib_path complaint_re readnow_p } {
- clean_restart $exec_path
+ clean_restart
+ gdb_load $exec_path
gdb_load_shlib $lib_path
if { ![runto_main] } {
return
}
-clean_restart $binfile
+clean_restart $::testfile
if {![runto_main]} {
return
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if ![runto_main] {
return -1
gdb_remote_download host $dwo_file
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test "ptype global_var" "type = int"
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if ![runto_main] {
return -1
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if ![runto_main] {
return -1
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
gdb_test "break -q main" "Breakpoint .*"
return -1
}
-clean_restart $binfile
+clean_restart $::testfile
if ![runto_main] {
return -1
remote_file target delete $dwo
save_vars { GDBFLAGS } {
append GDBFLAGS " -iex \"maint set dwarf synchronous on\""
- clean_restart $binfile
+ clean_restart $::testfile
}
set output_dir [standard_output_file ""]
set cmd "save gdb-index"
return
}
-clean_restart $binfile
+clean_restart $::testfile
if { [gdb_starti_cmd] != 0 } {
fail "failed to run to first instruction"
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart $symlink
+clean_restart
+gdb_load $symlink
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart ${binfile}
+clean_restart ${::testfile}
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
}
# Start GDB and load in the executable.
-clean_restart ${binfile}
+clean_restart ${::testfile}
# If the executable was built with an index, or lacks the debug
# information required to create an index, then we'll not be able to
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
# Verify that .gdb_index section is not ignored.
set index [have_index $binfile]
set filter "gdb_index|debug_names|Psymtabs|Cooked"
set cmd "pipe mt print objfiles ${testfile} | grep -E \"$filter\""
set cmd_re [string_to_regexp $cmd]
+set testfile_with_index bla
gdb_test_multiple $cmd $test {
-re ^$cmd_re {
exp_continue
}
-re "gdb_index.*${gdb_prompt} $" {
- set binfile_with_index $binfile
+ set testfile_with_index $testfile
+ set binfile_with_index [standard_output_file $testfile_with_index]
set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "debug_names.*${gdb_prompt} $" {
- set binfile_with_index $binfile
+ set testfile_with_index $testfile
+ set binfile_with_index [standard_output_file $testfile_with_index]
set host_binfile_with_index [gdb_remote_download host $binfile]
}
-re "(Psymtabs|Cooked).*${gdb_prompt} $" {
lassign [local_add_gdb_index $binfile] binfile_with_index host_binfile_with_index
+ set testfile_with_index [file tail $binfile_with_index]
if { ${binfile_with_index} == "" } {
return -1
}
# Ok, we have a copy of $binfile with an index.
# Restart gdb and verify the index was used.
-clean_restart ${binfile_with_index}
+clean_restart $testfile_with_index
gdb_test "mt print objfiles ${testfile}" \
"(gdb_index|debug_names).*" \
"index used"
return -1
}
-clean_restart ${binfile}
+clean_restart ${::testfile}
runto main
### Second GDB session.
with_test_prefix "second session" {
- clean_restart $binfile
+ clean_restart $::testfile
# Again, do whatever is necessary to make sure that the shared library is
# loaded for remote targets.