public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdbserver: Don't try to reopen stdio just quit
@ 2024-06-11 22:19 Mark Wielaard
  2024-06-12 13:55 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2024-06-11 22:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Wielaard

The testsuite sometimes leaves around gdbserver processes that are
stuck in a loop trying to reopen stdio, which will not work. Once the
write side of the pipe is gone it won't come back because it cannot be
reconnected to another process.

This requires the buildbot to killall gdbserver after running check-gdb.

Add an extra check for remote_connection_is_stdio () in captured_main
to quit in the gdbserver was started through a pipe with - as comm
and stdio as event source is gone.
---
 gdbserver/server.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 6f9d2a85609b..c22aa98854cc 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -4382,13 +4382,18 @@ captured_main (int argc, char *argv[])
 
 	      - If --once was specified, we're done.
 
+	      - If the remote connection was stdio it is now closed
+		and it will not reopen.
+
 	      - If not in extended-remote mode, and we're no longer
 		debugging anything, simply exit: GDB has disconnected
 		after processing the last process exit.
 
 	      - Otherwise, close the connection and reopen it at the
 		top of the loop.  */
-	  if (run_once || (!extended_protocol && !target_running ()))
+	  if (run_once
+	      || remote_connection_is_stdio ()
+	      || (!extended_protocol && !target_running ()))
 	    throw_quit ("Quit");
 
 	  fprintf (stderr,
-- 
2.45.2


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

end of thread, other threads:[~2024-06-13 16:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 22:19 [PATCH] gdbserver: Don't try to reopen stdio just quit Mark Wielaard
2024-06-12 13:55 ` Tom Tromey
2024-06-12 14:37   ` Mark Wielaard
2024-06-12 18:44     ` Tom Tromey
2024-06-12 19:22       ` Mark Wielaard
2024-06-12 19:29         ` Guinevere Larsen
2024-06-13 16:18         ` Tom Tromey

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