From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id D300C3858C74; Tue, 17 May 2022 10:15:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D300C3858C74 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 1fe69430d166bf287fe94a7fcecc7f867666ae5a X-Git-Newrev: 8d08cccb0147025f028898542263e3f83259bba9 Message-Id: <20220517101514.D300C3858C74@sourceware.org> Date: Tue, 17 May 2022 10:15:14 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 10:15:14 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D8d08cccb0147= 025f028898542263e3f83259bba9 commit 8d08cccb0147025f028898542263e3f83259bba9 Author: Pedro Alves Date: Wed Mar 30 14:31:56 2022 +0100 Avoid having to unload file in gdb.server/connect-with-no-symbol-file.e= xp =20 gdb.server/connect-with-no-symbol-file.exp's connect_no_symbol_file does: =20 gdb_test "file" ".*" "discard symbol table" \ {Discard symbol table from `.*'\? \(y or n\) } "y" =20 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. =20 Fix this by not loading a file into GDB in the first place. =20 Change-Id: I810c036b57842c4c5b47faf340466b0d446d1abc Diff: --- .../gdb.server/connect-with-no-symbol-file.exp | 17 +++++++------= ---- 1 file 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 af5917d9018..6c480c8c0cf 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 } =20 -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } =20 @@ -46,22 +46,16 @@ proc connect_no_symbol_file { sysroot action } { =20 with_test_prefix "setup" { # Copy the symbol file to the target. - gdb_remote_download target $binfile.bak $binfile=20 + set target_exec [gdb_remote_download target $binfile.bak $binfile] =20 # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. gdb_test "disconnect" ".*" =20 - # 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" =20 - set target_exec [gdbserver_download_current_prog] - # Start GDBserver. set res [gdbserver_start "" $target_exec] =20 @@ -70,9 +64,9 @@ proc connect_no_symbol_file { sysroot action } { =20 # Perform test actions to the symbol file on the target. if { $action =3D=3D "delete" } then { - remote_file target delete $binfile + remote_file target delete $target_exec } elseif { $action =3D=3D "permission" } { - remote_spawn target "chmod 000 $binfile" + remote_spawn target "chmod 000 $target_exec" } =20 # 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 =20 +# Start with no executable loaded. +clean_restart + # Run the test with different permutations. foreach_with_prefix sysroot {"" "target:"} { foreach_with_prefix action {"permission" "delete"} {