diff options
author | Pedro Alves <pedro@palves.net> | 2022-03-30 14:31:56 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-05-17 10:31:36 +0100 |
commit | 8d08cccb0147025f028898542263e3f83259bba9 (patch) | |
tree | 37209f23fd55b8f0b41182ae1b1c31d4d4d3b1c0 | |
parent | 1fe69430d166bf287fe94a7fcecc7f867666ae5a (diff) | |
download | binutils-8d08cccb0147025f028898542263e3f83259bba9.zip binutils-8d08cccb0147025f028898542263e3f83259bba9.tar.gz binutils-8d08cccb0147025f028898542263e3f83259bba9.tar.bz2 |
Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp
gdb.server/connect-with-no-symbol-file.exp's connect_no_symbol_file
does:
gdb_test "file" ".*" "discard symbol table" \
{Discard symbol table from `.*'\? \(y or n\) } "y"
A following patch will make gdb_test expect the question out of GDB if
one is passed down as argument to gdb_test. With that, this test
starts failing. This is because connect_no_symbol_file is called in a
loop, and the first time around, there's a loaded file, so "file" asks
the "Discard symbol table ... ?" question, while in the following
iterations there's no file, so there's no question.
Fix this by not loading a file into GDB in the first place.
Change-Id: I810c036b57842c4c5b47faf340466b0d446d1abc
-rw-r--r-- | gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp index af5917d..6c480c8 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -29,7 +29,7 @@ if { [skip_gdbserver_tests] } { return 0 } -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } @@ -46,22 +46,16 @@ proc connect_no_symbol_file { sysroot action } { with_test_prefix "setup" { # Copy the symbol file to the target. - gdb_remote_download target $binfile.bak $binfile + set target_exec [gdb_remote_download target $binfile.bak $binfile] # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. gdb_test "disconnect" ".*" - # Discard any symbol files that we have opened. - gdb_test "file" ".*" "discard symbol table" \ - {Discard symbol table from `.*'\? \(y or n\) } "y" - # Set sysroot to something non-target and possibly also invalid so that # GDB is unable to open the symbol file. gdb_test_no_output "set sysroot $sysroot" "adjust sysroot" - set target_exec [gdbserver_download_current_prog] - # Start GDBserver. set res [gdbserver_start "" $target_exec] @@ -70,9 +64,9 @@ proc connect_no_symbol_file { sysroot action } { # Perform test actions to the symbol file on the target. if { $action == "delete" } then { - remote_file target delete $binfile + remote_file target delete $target_exec } elseif { $action == "permission" } { - remote_spawn target "chmod 000 $binfile" + remote_spawn target "chmod 000 $target_exec" } # Connect to GDBserver. @@ -89,6 +83,9 @@ proc connect_no_symbol_file { sysroot action } { # Make sure we have the original symbol file in a safe place to copy from. gdb_remote_download host $binfile $binfile.bak +# Start with no executable loaded. +clean_restart + # Run the test with different permutations. foreach_with_prefix sysroot {"" "target:"} { foreach_with_prefix action {"permission" "delete"} { |