From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/5] Avoid having to unload file in gdb.server/connect-with-no-symbol-file.exp
Date: Wed, 30 Mar 2022 20:29:28 +0100 [thread overview]
Message-ID: <20220330192929.3161015-5-pedro@palves.net> (raw)
In-Reply-To: <20220330192929.3161015-1-pedro@palves.net>
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
---
.../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
}
-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"} {
--
2.26.2
next prev parent reply other threads:[~2022-03-30 19:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 19:29 [PATCH 0/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-03-30 19:29 ` [PATCH 1/5] Remove gdb_test questions that GDB doesn't ask Pedro Alves
2022-03-30 19:29 ` [PATCH 2/5] gdb.base/scope.exp: Remove bogus gdb_test questions Pedro Alves
2022-03-30 19:29 ` [PATCH 3/5] Fix bogus gdb_test invocations Pedro Alves
2022-03-30 19:29 ` Pedro Alves [this message]
2022-03-30 19:29 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Pedro Alves
2022-04-07 20:31 ` Bruno Larsen
2022-04-08 12:18 ` Pedro Alves
2022-05-17 10:13 ` [PATCH 5/6] gdb.base/skip.exp: Don't abuse gdb_test's question support (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-16 16:01 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Tom Tromey
2022-05-17 11:25 ` Pedro Alves
2022-05-17 22:48 ` Tom Tromey
2022-05-18 11:01 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-18 12:15 ` Tom de Vries
2022-05-18 12:36 ` Pedro Alves
2022-05-18 14:13 ` Pedro Alves
2022-05-18 14:49 ` Tom de Vries
2022-05-18 20:34 ` Tom Tromey
2022-05-19 12:42 ` Pedro Alves
2022-05-23 10:48 ` Tom de Vries
2022-05-23 12:01 ` Tom de Vries
2022-05-23 12:50 ` [committed][gdb/testsuite] Fix -prompt handling in gdb_test Tom de Vries
2022-05-23 12:53 ` [pushed] Support -prompt and -lbl in gdb_test (Re: [PATCH 5/5] Make gdb_test's question non-optional if specified) Pedro Alves
2022-05-17 11:41 ` [PATCH 5/5] Make gdb_test's question non-optional if specified Simon Marchi
2022-05-17 12:04 ` Pedro Alves
2022-05-16 16:02 ` [PATCH 0/5] " Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220330192929.3161015-5-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).