public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/7] [gdb/testsuite] Fix gdb.server/connect-with-no-symbol-file.exp for remote target
@ 2023-03-09  9:45 Tom de Vries
  2023-03-09  9:45 ` [PATCH 2/7] [gdb/testsuite] Fix gdb.server/server-kill.exp " Tom de Vries
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

Test-case gdb.server/connect-with-no-symbol-file.exp fails with target board
remote-gdbserver-on-localhost.

The problem is here:
...
       set target_exec [gdb_remote_download target $binfile.bak $binfile]
...
A "gdb_remote_download target" copies from build to target.  So $binfile is
assumed to be a target path, but it's actually a build path.

Fix this by:
- fist copying $binfile.bak to $binfile, and
- simply doing [gdb_remote_download target $binfile].

Then, $binfile.bak is created here:
...
 # Make sure we have the original symbol file in a safe place to copy from.
 gdb_remote_download host $binfile $binfile.bak
...
and since "gdb_remote_download host" copies from build to host, $binfile.bak
is assumed to be a host path, but it's actually a build path.  This happens to
cause no problems in this configuration (because build == host), but it would
for a remote host configuration.

So let's fix this by making build rather than host the "safe place to copy
from".

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp | 7 +++++--
 1 file changed, 5 insertions(+), 2 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 b98e566e2d6..efddccd2a19 100644
--- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
+++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp
@@ -43,8 +43,11 @@ proc connect_no_symbol_file { sysroot action } {
     global binfile
 
     with_test_prefix "setup" {
+	# Restore original $binfile.
+	gdb_remote_download build $binfile.bak $binfile
+
 	# Copy the symbol file to the target.
-	set target_exec [gdb_remote_download target $binfile.bak $binfile]
+	set target_exec [gdb_remote_download target $binfile]
 
 	# Make sure we're disconnected, in case we're testing with an
 	# extended-remote board, therefore already connected.
@@ -89,7 +92,7 @@ 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
+gdb_remote_download build $binfile $binfile.bak
 
 # Start with no executable loaded.
 clean_restart

base-commit: bf0e35375461ef2a17e2872e7f5c1446a5924b64
-- 
2.35.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-09 13:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09  9:45 [PATCH 1/7] [gdb/testsuite] Fix gdb.server/connect-with-no-symbol-file.exp for remote target Tom de Vries
2023-03-09  9:45 ` [PATCH 2/7] [gdb/testsuite] Fix gdb.server/server-kill.exp " Tom de Vries
2023-03-09  9:45 ` [PATCH 3/7] [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp " Tom de Vries
2023-03-09  9:45 ` [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp " Tom de Vries
2023-03-09 13:42   ` Tom de Vries
2023-03-09  9:45 ` [PATCH 5/7] [gdb/testsuite] Fix gdbserver path in remote-stdio-gdbserver.exp Tom de Vries
2023-03-09  9:45 ` [PATCH 6/7] [gdb/testsuite] Fix gdb.server/unittest.exp for remote target Tom de Vries
2023-03-09  9:45 ` [PATCH 7/7] [gdb/testsuite] Fix gdb.server/*.exp " Tom de Vries
2023-03-09 11:30 ` [PATCH 1/7] [gdb/testsuite] Fix gdb.server/connect-with-no-symbol-file.exp " Tom de Vries

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).