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

* [PATCH 2/7] [gdb/testsuite] Fix gdb.server/server-kill.exp for remote target
  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 ` Tom de Vries
  2023-03-09  9:45 ` [PATCH 3/7] [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp " Tom de Vries
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

In commit 80dc83fd0e7 ("gdb/remote: handle target dying just before a stepi")
an observation is made that test-case gdb.server/server-kill.exp claims to
kill gdbserver, but actually kills the inferior.  Consequently, the commit
adds testing of killing gdbserver alongside.

The problem is that:
- the original observation is incorrect (possibly caused by misreading getppid
  as getpid)
- consequently, the test-case doesn't test killing the inferior, instead it
  tests killing gdbserver twice
- the method to get the gdbserver PID added in the commit doesn't work
  for target board remote-gdbserver-on-localhost, it returns the
  PID of the ssh client session instead.

Fixing the method for getting the inferior PID gives us fails, and there's no
evidence that killing the inferior ever worked.

So, fix this by reverting the commit and just killing gdbserver, using the
original method of getting the gdbserver PID which does work for target board
remote-gdbserver-on-localhost.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/server-kill.exp | 47 +++++-------------------
 1 file changed, 10 insertions(+), 37 deletions(-)

diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
index 5622b27f6bf..0e9df6e1a5f 100644
--- a/gdb/testsuite/gdb.server/server-kill.exp
+++ b/gdb/testsuite/gdb.server/server-kill.exp
@@ -28,21 +28,6 @@ if { [build_executable "failed to prepare" ${testfile}] } {
     return -1
 }
 
-# Global control variable used by the proc prepare.  Should be set to
-# either 'inferior' or 'server'.
-#
-# In the proc prepare we start gdbserver and extract a pid, which will
-# later be killed by calling the proc kill_server.
-#
-# When KILL_PID_OF is set to 'inferior' then the pid we kill is that
-# of the inferior running under gdbserver, when this process dies
-# gdbserver itself will exit.
-#
-# When KILL_PID_OF is set to 'server' then the pid we kill is that of
-# the gdbserver itself, this is a much more aggressive strategy and
-# exposes different bugs within GDB.
-set kill_pid_of "inferior"
-
 # Spawn GDBserver, run to main, extract GDBserver's PID and save it in
 # the SERVER_PID global.
 
@@ -67,24 +52,16 @@ proc prepare {} {
 
     gdbserver_run ""
 
-    # Continue past server_pid assignment.  We do this for both scenarios,
-    # to avoid doing a backtrace from _start, which may not trigger remote
-    # communication.
     gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"]
     gdb_continue_to_breakpoint "after server_pid assignment"
 
-    if { $::kill_pid_of == "inferior" } {
-	# Get the pid of GDBServer.
-	set test "p server_pid"
-	set server_pid 0
-	gdb_test_multiple $test $test {
-	    -re " = ($decimal)\r\n$gdb_prompt $" {
-		set server_pid $expect_out(1,string)
-		pass $test
-	    }
+    # Get the pid of GDBServer.
+    set server_pid 0
+    gdb_test_multiple "p server_pid" "" {
+	-re -wrap " = ($decimal)" {
+	    set server_pid $expect_out(1,string)
+	    pass $gdb_test_name
 	}
-    } else {
-	set server_pid [exp_pid -i $::server_spawn_id]
     }
 
     if {$server_pid == 0} {
@@ -165,12 +142,8 @@ proc_with_prefix test_stepi {} {
     gdb_test "stepi" "(Target disconnected|Remote connection closed|Remote communication error).*"
 }
 
-# Run each test twice, see the description of KILL_PID_OF earlier in
-# this file for more details.
+test_tstatus
+test_unwind_nosyms
+test_unwind_syms
+test_stepi
 
-foreach_with_prefix kill_pid_of { "inferior" "server" } {
-    test_tstatus
-    test_unwind_nosyms
-    test_unwind_syms
-    test_stepi
-}
-- 
2.35.3


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

* [PATCH 3/7] [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp for remote target
  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 ` Tom de Vries
  2023-03-09  9:45 ` [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp " Tom de Vries
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

Test-case gdb.server/multi-ui-errors.exp fails for target board
remote-gdbserver-on-localhost with REMOTE_TARGET_USERNAME=remote-target:
...
(gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI
Executing on target: kill -9 6447    (timeout = 300)
builtin_spawn [open ...]^M
XYZ1ZYX
sh: line 0: kill: (6447) - Operation not permitted
...

The problem is that the kill command:
...
remote_exec target "kill -9 $gdbserver_pid"
...
intended to kill gdbserver instead tries to kill the ssh client session in
which the gdbserver runs, and fails because it's trying as the remote target
user (remote-target on localhost) to kill a pid owned by the the build user
($USER on localhost).

Fix this by getting the gdbserver pid using the ppid trick from
server-kill.exp.

Likewise in gdb.server/server-kill-python.exp.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/multi-ui-errors.c    |  5 ++++
 gdb/testsuite/gdb.server/multi-ui-errors.exp  | 29 +++++++++++++++++++
 .../gdb.server/server-kill-python.exp         | 23 ++++++++++++++-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.c b/gdb/testsuite/gdb.server/multi-ui-errors.c
index 09739198cc1..afa1815fbee 100644
--- a/gdb/testsuite/gdb.server/multi-ui-errors.c
+++ b/gdb/testsuite/gdb.server/multi-ui-errors.c
@@ -17,12 +17,17 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#include <sys/types.h>
+
+pid_t server_pid;
 
 int
 main (void)
 {
   int i;
 
+  server_pid = getppid ();
+
   printf ("@@XX@@ Inferior Starting @@XX@@\n");
 
   for (i = 0; i < 120; ++i)
diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp
index 9cc5239d888..266207a5f4b 100644
--- a/gdb/testsuite/gdb.server/multi-ui-errors.exp
+++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp
@@ -100,6 +100,35 @@ with_spawn_id $gdb_main_spawn_id {
     gdb_test "echo hello\\n" "hello" "interact with GDB's main UI"
 }
 
+# Get the gdbserver PID.
+set gdbserver_pid 0
+with_spawn_id $gdb_main_spawn_id {
+    gdb_test "interrupt"
+
+    gdb_test_multiple "" "interrupt arrived" {
+	-re "Program received signal SIGINT, Interrupt\\.\r\n" {
+	    pass $gdb_test_name
+	}
+    }
+
+    gdb_test_multiple "p server_pid" "" {
+	-re -wrap " = ($decimal)" {
+	    set gdbserver_pid $expect_out(1,string)
+	    pass $gdb_test_name
+	}
+    }
+
+    gdb_test_multiple continue "" {
+	-re "Continuing\\.\r\n" {
+	    pass $gdb_test_name
+	}
+    }
+}
+
+if { $gdbserver_pid == 0 } {
+    return
+}
+
 # Now kill the gdbserver.
 remote_exec target "kill -9 $gdbserver_pid"
 
diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp
index 7b8f29b2890..f6b373065a8 100644
--- a/gdb/testsuite/gdb.server/server-kill-python.exp
+++ b/gdb/testsuite/gdb.server/server-kill-python.exp
@@ -30,12 +30,16 @@ if {[build_executable "failed to prepare" ${testfile} \
     return -1
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Start gdbserver.
-set res [gdbserver_spawn "${binfile}"]
+set res [gdbserver_spawn "${target_binfile}"]
 set gdbserver_protocol [lindex $res 0]
 set gdbserver_gdbport [lindex $res 1]
 set gdbserver_pid [exp_pid -i $server_spawn_id]
 
+set break_linenr [gdb_get_line_number "@@XX@@ Inferior Starting @@XX@@"]
+
 # Generate a python script we will later source.
 set file1 [standard_output_file file1.py]
 set fd [open "$file1" w]
@@ -44,6 +48,9 @@ puts $fd \
 
 def do_gdb_stuff ():
     gdb.execute ('target $gdbserver_protocol $gdbserver_gdbport')
+    gdb.execute ('break $srcfile:$break_linenr')
+    gdb.execute ('continue')
+    gdb.execute ('p server_pid')
     gdb.execute ('continue')
 
 do_gdb_stuff()"
@@ -57,8 +64,22 @@ if {[gdb_spawn_with_cmdline_opts \
     return
 }
 
+# Get the gdbserver PID.
+set gdbserver_pid 0
+
 # Wait for the inferior to start up.
 with_spawn_id $server_spawn_id {
+    gdb_test_multiple "" "get gdbserver PID" {
+	-re " = ($decimal)\r\n" {
+	    set gdbserver_pid $expect_out(1,string)
+	    pass $gdb_test_name
+	}
+    }
+
+    if { $gdbserver_pid == 0 } {
+	return
+    }
+
     gdb_test_multiple "" "ensure inferior is running" {
 	-re "@@XX@@ Inferior Starting @@XX@@" {
 	    pass $gdb_test_name
-- 
2.35.3


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

* [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp for remote target
  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 ` 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
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

Fix test-case gdb.server/sysroot.exp with target board
remote-gdbserver-on-localhost, by:
- using gdb_remote_download, and
- disabling the "local" scenario for remote host.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/sysroot.exp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp
index 715d6001020..ac2a03d0c8f 100644
--- a/gdb/testsuite/gdb.server/sysroot.exp
+++ b/gdb/testsuite/gdb.server/sysroot.exp
@@ -27,9 +27,17 @@ if {[build_executable "failed to prepare" $testfile $srcfile "additional_flags=-
     return -1
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Run once with sysroot set to the local filesystem and once set to the remote
 # target.
-foreach_with_prefix sysroot { "local" "remote" } {
+set modes {}
+if { ![is_remote target] } {
+    lappend modes "local"
+}
+lappend modes "remote"
+
+foreach_with_prefix sysroot $modes {
     global srcdir
     global subdir
     global binfile
@@ -40,7 +48,7 @@ foreach_with_prefix sysroot { "local" "remote" } {
 	set timeout_factor 1
     } else {
 	set sysroot_command "target:"
-	set reading_symbols "Reading $binfile from remote target..."
+	set reading_symbols "Reading .*$target_binfile from remote target..."
 	set timeout_factor 5
     }
 
@@ -55,7 +63,7 @@ foreach_with_prefix sysroot { "local" "remote" } {
 	gdb_test "disconnect" ".*"
 
 	# Start GDBserver.
-	set res [gdbserver_start "" $binfile]
+	set res [gdbserver_start "" $target_binfile]
 	set gdbserver_protocol [lindex $res 0]
 	set gdbserver_gdbport [lindex $res 1]
 
-- 
2.35.3


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

* [PATCH 5/7] [gdb/testsuite] Fix gdbserver path in remote-stdio-gdbserver.exp
  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
                   ` (2 preceding siblings ...)
  2023-03-09  9:45 ` [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp " Tom de Vries
@ 2023-03-09  9:45 ` Tom de Vries
  2023-03-09  9:45 ` [PATCH 6/7] [gdb/testsuite] Fix gdb.server/unittest.exp for remote target Tom de Vries
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

With test-case gdb.server/unittest.exp and target board remote-stdio-gdbserver
I run into:
...
(gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost /usr/bin/gdbserver \
  --selftest^M
Selftests have been disabled for this build.^M
UNSUPPORTED: gdb.server/unittest.exp: unit tests
...
due to using the system gdbserver /usr/bin/gdbserver rather than the one from
the build.

Fix this by removing the hard-coding of /usr/bin/gdbserver in
remote-stdio-gdbserver, allowing find_gdbserver to do its work, such that we
have instead:
...
(gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \
  /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M
Running selftest remote_memory_tagging.^M
Ran 1 unit tests, 0 failed^M
Connection to localhost closed.^M^M
PASS: gdb.server/unittest.exp: unit tests
...

Tested on x86_64-linux.
---
 gdb/testsuite/boards/remote-stdio-gdbserver.exp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gdb/testsuite/boards/remote-stdio-gdbserver.exp b/gdb/testsuite/boards/remote-stdio-gdbserver.exp
index 47a0577733c..479dfb066a4 100644
--- a/gdb/testsuite/boards/remote-stdio-gdbserver.exp
+++ b/gdb/testsuite/boards/remote-stdio-gdbserver.exp
@@ -47,11 +47,9 @@ if [info exists REMOTE_TMPDIR] {
     set_board_info remotedir $REMOTE_TMPDIR
 }
 
-unset_board_info gdb_server_prog
 if [info exists GDBSERVER] {
+    unset_board_info gdb_server_prog
     set_board_info gdb_server_prog $GDBSERVER
-} else {
-    set_board_info gdb_server_prog /usr/bin/gdbserver
 }
 
 proc get_remote_login { } {
-- 
2.35.3


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

* [PATCH 6/7] [gdb/testsuite] Fix gdb.server/unittest.exp for remote target
  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
                   ` (3 preceding siblings ...)
  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 ` 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
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

With test-case gdb.server/unittest.exp and a build with --disable-unit-tests I
get:
...
(gdb) builtin_spawn /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver \
  --selftest^M
Selftests have been disabled for this build.^M
UNSUPPORTED: gdb.server/unittest.exp: unit tests
...
but with target board remote-stdio-gdbserver I get instead:
...
(gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \
  /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M
Selftests have been disabled for this build.^M
Connection to localhost closed.^M^M
FAIL: gdb.server/unittest.exp: unit tests
...

Fix this by making the regexp less strict.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/unittest.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp
index d25ee362644..2ef2865a11a 100644
--- a/gdb/testsuite/gdb.server/unittest.exp
+++ b/gdb/testsuite/gdb.server/unittest.exp
@@ -36,7 +36,7 @@ expect {
 	gdb_assert "$num_ran >= 0" $test
     }
 
-    -re "Selftests have been disabled for this build.\r\n$" {
+    -re "Selftests have been disabled for this build.\r\n" {
 	unsupported $test
     }
 
-- 
2.35.3


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

* [PATCH 7/7] [gdb/testsuite] Fix gdb.server/*.exp for remote target
  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
                   ` (4 preceding siblings ...)
  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 ` 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
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09  9:45 UTC (permalink / raw)
  To: gdb-patches

Fix test-cases for target board remote-gdbserver-on-localhost by using
gdb_remote_download.

Tested on x86_64-linux.
---
 .../gdb.server/exit-multiple-threads.exp         | 16 +++++++++-------
 gdb/testsuite/gdb.server/reconnect-ctrl-c.exp    |  4 +++-
 .../gdb.server/run-without-local-binary.exp      |  4 +++-
 .../gdb.server/stop-reply-no-thread-multi.exp    |  4 +++-
 .../gdb.server/stop-reply-no-thread.exp          |  4 +++-
 gdb/testsuite/gdb.server/twice-connect.exp       |  4 +++-
 6 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
index 87867f00e66..4e55873b1b5 100644
--- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp
+++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
@@ -35,7 +35,7 @@ standard_testfile
 #
 # Places a breakpoint in function 'breakpt' and then continues to the
 # breakpoint, at which point it runs 'info threads'.
-proc prepare_for_test { executable disable_multi_process } {
+proc prepare_for_test { executable target_executable disable_multi_process } {
     global GDBFLAGS
 
     save_vars { GDBFLAGS } {
@@ -65,7 +65,7 @@ proc prepare_for_test { executable disable_multi_process } {
     }
 
     # Start gdbserver and connect.
-    set res [gdbserver_start "" $executable]
+    set res [gdbserver_start "" $target_executable]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
     set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
@@ -83,10 +83,10 @@ proc prepare_for_test { executable disable_multi_process } {
 # we have multiple-threads.  EXECUTABLE is the binary under test, and
 # DISABLE_MULTI_PROCESS indicates if we should disable GDB's remote
 # multi-process support.
-proc run_exit_test { executable disable_multi_process } {
+proc run_exit_test { executable target_executable disable_multi_process } {
     global decimal
 
-    prepare_for_test ${executable} ${disable_multi_process}
+    prepare_for_test ${executable} $target_executable ${disable_multi_process}
 
     # Finally, continue until the process exits, ensure we don't see
     # any warnings between "Continuing." and the final process has
@@ -107,10 +107,10 @@ proc run_exit_test { executable disable_multi_process } {
 # while we have multiple-threads.  EXECUTABLE is the binary under
 # test, and DISABLE_MULTI_PROCESS indicates if we should disable GDB's
 # remote multi-process support.
-proc run_signal_test { executable disable_multi_process } {
+proc run_signal_test { executable target_executable disable_multi_process } {
     global decimal gdb_prompt
 
-    prepare_for_test ${executable} ${disable_multi_process}
+    prepare_for_test ${executable} $target_executable ${disable_multi_process}
 
     set inf_pid [get_valueof "/d" "global_pid" "unknown"]
     gdb_assert ![string eq ${inf_pid} "unknown"] "read the pid"
@@ -142,7 +142,9 @@ foreach_with_prefix test { exit signal } {
 	return -1
     }
 
+    set target_executable [gdb_remote_download target $executable]
+
     foreach_with_prefix multi_process { 0 1 } {
-	$func ${executable} ${multi_process}
+	$func ${executable} $target_executable ${multi_process}
     }
 }
diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
index c8ef81443e5..6146cc3888e 100644
--- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
+++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp
@@ -40,6 +40,8 @@ save_vars { GDBFLAGS } {
     }
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Make sure we're disconnected, in case we're testing with an
 # extended-remote board, therefore already connected.
 with_test_prefix "preparation" {
@@ -70,7 +72,7 @@ proc connect_continue_ctrl_c {} {
 with_test_prefix "first" {
     # Start GDBserver.
     set gdbserver_reconnect_p 1
-    set res [gdbserver_start "" $binfile]
+    set res [gdbserver_start "" $target_binfile]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
index c390eeb435a..08620e0ec3e 100644
--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
@@ -23,6 +23,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Test running GDB without providing a local binary for it.  In order
 # to do that, we unset GDBFLAGS before running GDB.  We also start
 # gdbserver "by hand".  For more details about this test, see PR
@@ -39,7 +41,7 @@ save_vars { GDBFLAGS } {
     gdb_exit
     gdb_start
 
-    gdb_test_no_output "set remote exec-file $binfile" \
+    gdb_test_no_output "set remote exec-file $target_binfile" \
 	"set remote exec-file"
 
     # Make sure we're disconnected, in case we're testing with an
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
index 042c285d98a..cf6be64fab3 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp
@@ -37,6 +37,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]
     return -1
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Run the tests with different features of GDBserver disabled.
 # TARGET_NON_STOP is passed to "maint set target-non-stop".
 proc run_test { target_non_stop disable_feature } {
@@ -63,7 +65,7 @@ proc run_test { target_non_stop disable_feature } {
     if { $disable_feature != "" } {
 	set packet_arg "--disable-packet=${disable_feature}"
     }
-    set res [gdbserver_start $packet_arg $binfile]
+    set res [gdbserver_start $packet_arg $::target_binfile]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
index 3ef512bc637..65db483e8de 100644
--- a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
+++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp
@@ -29,6 +29,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile] == -1 } {
     return -1
 }
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Run the tests with different features of GDBserver disabled.
 proc run_test { disable_feature target_nonstop } {
     global binfile gdb_prompt decimal GDBFLAGS
@@ -51,7 +53,7 @@ proc run_test { disable_feature target_nonstop } {
     if { $disable_feature != "" } {
 	set packet_arg "--disable-packet=${disable_feature}"
     }
-    set res [gdbserver_start $packet_arg $binfile]
+    set res [gdbserver_start $packet_arg $::target_binfile]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
diff --git a/gdb/testsuite/gdb.server/twice-connect.exp b/gdb/testsuite/gdb.server/twice-connect.exp
index 8ff8334f5f2..fd76ea0ce3e 100644
--- a/gdb/testsuite/gdb.server/twice-connect.exp
+++ b/gdb/testsuite/gdb.server/twice-connect.exp
@@ -29,9 +29,11 @@ if { [build_executable "failed to prepare" $::testfile $::srcfile \
 # Don't use $binfile arg, to make sure we use the remote file target:$binfile.
 clean_restart
 
+set target_binfile [gdb_remote_download target $binfile]
+
 # Start gdbserver, and connect to it, twice.
 foreach_with_prefix session {first second} {
-    lassign [gdbserver_start "" "$binfile"] unused gdbserver_address
+    lassign [gdbserver_start "" "$target_binfile"] unused gdbserver_address
     gdb_test "disconnect"
     set res [gdb_target_cmd "remote" $gdbserver_address]
     gdb_assert { $res == 0 } "gdbserver started"
-- 
2.35.3


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

* Re: [PATCH 1/7] [gdb/testsuite] Fix gdb.server/connect-with-no-symbol-file.exp for remote target
  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
                   ` (5 preceding siblings ...)
  2023-03-09  9:45 ` [PATCH 7/7] [gdb/testsuite] Fix gdb.server/*.exp " Tom de Vries
@ 2023-03-09 11:30 ` Tom de Vries
  6 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09 11:30 UTC (permalink / raw)
  To: gdb-patches

I actually meant to submit the series with pushed tag, so ... pushed.

Thanks,
- Tom

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

* Re: [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp for remote target
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Tom de Vries @ 2023-03-09 13:42 UTC (permalink / raw)
  To: gdb-patches

On 3/9/23 10:45, Tom de Vries via Gdb-patches wrote:
> - disabling the "local" scenario for remote host.

That should have been "remote target".

Thanks,
- Tom

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