public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: gdb-patches@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] gdbserver: Don't try to reopen stdio just quit
Date: Wed, 12 Jun 2024 00:19:16 +0200	[thread overview]
Message-ID: <20240611221916.3146658-1-mark@klomp.org> (raw)

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


             reply	other threads:[~2024-06-11 22:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 22:19 Mark Wielaard [this message]
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

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=20240611221916.3146658-1-mark@klomp.org \
    --to=mark@klomp.org \
    --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).