Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb.multi/attach-no-multi-process.exp: Detect no remote non-stop
@ 2025-06-06 16:29 Pedro Alves
  2025-06-06 17:15 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2025-06-06 16:29 UTC (permalink / raw)
  To: gdb-patches

Running gdb.multi/attach-no-multi-process.exp on Cygwin, where
GDBserver does not support non-stop mode, I see:

 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: info threads
 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: attach to the program via remote (timeout)
 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: info threads (timeout)

Let's ignore the first "info threads" fail.  The timeouts look like
this:

 builtin_spawn /home/alves/gdb-cache-cygwin/gdb/../gdbserver/gdbserver --once --multi localhost:2346
 Listening on port 2346
 target extended-remote localhost:2346
 Remote debugging using localhost:2346
 Non-stop mode requested, but remote does not support non-stop
 (gdb) gdb_do_cache: can_spawn_for_attach (  )
 builtin_spawn /home/alves/gdb/build-cygwin-testsuite/outputs/gdb.multi/attach-no-multi-process/attach-no-multi-process
 attach 14540
 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: attach to the program via remote (timeout)
 info threads
 FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: info threads (timeout)

Note the "Non-stop mode requested, but remote does not support
non-stop" line.

The intro to gdb_target_cmd_ext says:

 # gdb_target_cmd_ext
 # Send gdb the "target" command.  Returns 0 on success, 1 on failure, 2 on
 # unsupported.

That's perfect here, we can just use gdb_target_cmd_ext instead of
gdb_target_cmd, and check for 2 (unsupported).  That's what this patch
does.

However gdb_target_cmd_ext incorrectly returns 1 instead of 2 for the
case where the remote target says it does not support non-stop.  That
is also fixed by this patch.

With this, we no longer get those timeout fails.  We get instead:

 target extended-remote localhost:2346
 Remote debugging using localhost:2346
 Non-stop mode requested, but remote does not support non-stop
 (gdb) UNSUPPORTED: gdb.multi/attach-no-multi-process.exp: target_non_stop=on: non-stop RSP

Change-Id: I1ab3162f74200c6c02a17a0600b102d2d12db236
---
 gdb/testsuite/gdb.multi/attach-no-multi-process.exp | 5 ++++-
 gdb/testsuite/lib/gdbserver-support.exp             | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
index 28aabaf9edf..502f30940cc 100644
--- a/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
+++ b/gdb/testsuite/gdb.multi/attach-no-multi-process.exp
@@ -59,7 +59,10 @@ proc test {target_non_stop} {
 	"switch to inferior 2"
     set res [gdbserver_start "--multi" ""]
     set gdbserver_gdbport [lindex $res 1]
-    gdb_target_cmd "extended-remote" $gdbserver_gdbport
+    if { [gdb_target_cmd_ext "extended-remote" $gdbserver_gdbport] == 2 } {
+	unsupported "non-stop RSP"
+	return
+    }
 
     # Start a program, then attach to it.
     set spawn_id_list [spawn_wait_for_attach [list $binfile]]
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index c2850724c52..23892068c97 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -69,7 +69,7 @@ proc gdb_target_cmd_ext { targetname serialport {additional_text ""} } {
 	    }
 	    -re "Non-stop mode requested, but remote does not support non-stop.*$gdb_prompt $" {
 		verbose "remote does not support non-stop"
-		return 1
+		return 2
 	    }
 	    -re "Remote MIPS debugging.*$additional_text.*$gdb_prompt" {
 		verbose "Set target to $targetname"

base-commit: e9770f7889e72297a179b5596894f4bbdb105224
-- 
2.49.0


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

* Re: [PATCH] gdb.multi/attach-no-multi-process.exp: Detect no remote non-stop
  2025-06-06 16:29 [PATCH] gdb.multi/attach-no-multi-process.exp: Detect no remote non-stop Pedro Alves
@ 2025-06-06 17:15 ` Kevin Buettner
  2025-06-11 14:01   ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2025-06-06 17:15 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri,  6 Jun 2025 17:29:31 +0100
Pedro Alves <pedro@palves.net> wrote:

> Running gdb.multi/attach-no-multi-process.exp on Cygwin, where
> GDBserver does not support non-stop mode, I see:
> 
>  FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: info
> threads FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on:
> attach to the program via remote (timeout) FAIL:
> gdb.multi/attach-no-multi-process.exp: target_non_stop=on: info threads
> (timeout)
> 
> Let's ignore the first "info threads" fail.  The timeouts look like
> this:
> 
>  builtin_spawn /home/alves/gdb-cache-cygwin/gdb/../gdbserver/gdbserver
> --once --multi localhost:2346 Listening on port 2346
>  target extended-remote localhost:2346
>  Remote debugging using localhost:2346
>  Non-stop mode requested, but remote does not support non-stop
>  (gdb) gdb_do_cache: can_spawn_for_attach (  )
>  builtin_spawn
> /home/alves/gdb/build-cygwin-testsuite/outputs/gdb.multi/attach-no-multi-process/attach-no-multi-process
> attach 14540 FAIL: gdb.multi/attach-no-multi-process.exp:
> target_non_stop=on: attach to the program via remote (timeout) info
> threads FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=on:
> info threads (timeout)
> 
> Note the "Non-stop mode requested, but remote does not support
> non-stop" line.
> 
> The intro to gdb_target_cmd_ext says:
> 
>  # gdb_target_cmd_ext
>  # Send gdb the "target" command.  Returns 0 on success, 1 on failure, 2
> on # unsupported.
> 
> That's perfect here, we can just use gdb_target_cmd_ext instead of
> gdb_target_cmd, and check for 2 (unsupported).  That's what this patch
> does.
> 
> However gdb_target_cmd_ext incorrectly returns 1 instead of 2 for the
> case where the remote target says it does not support non-stop.  That
> is also fixed by this patch.
> 
> With this, we no longer get those timeout fails.  We get instead:
> 
>  target extended-remote localhost:2346
>  Remote debugging using localhost:2346
>  Non-stop mode requested, but remote does not support non-stop
>  (gdb) UNSUPPORTED: gdb.multi/attach-no-multi-process.exp:
> target_non_stop=on: non-stop RSP

LGTM.

Approved-by: Kevin Buettner <kevinb@redhat.com>


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

* Re: [PATCH] gdb.multi/attach-no-multi-process.exp: Detect no remote non-stop
  2025-06-06 17:15 ` Kevin Buettner
@ 2025-06-11 14:01   ` Pedro Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2025-06-11 14:01 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

On 2025-06-06 18:15, Kevin Buettner wrote:

> LGTM.
> 
> Approved-by: Kevin Buettner <kevinb@redhat.com>
> 

Thanks Kevin.  I've pushed it.


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

end of thread, other threads:[~2025-06-11 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-06 16:29 [PATCH] gdb.multi/attach-no-multi-process.exp: Detect no remote non-stop Pedro Alves
2025-06-06 17:15 ` Kevin Buettner
2025-06-11 14:01   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox