public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdbserver] Imply --once if connecting via stdio
@ 2024-05-24 21:15 William Ferreira
  2024-05-31 16:04 ` Guinevere Larsen
  2024-06-03 15:25 ` Andrew Burgess
  0 siblings, 2 replies; 3+ messages in thread
From: William Ferreira @ 2024-05-24 21:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: William Ferreira

Currently, gdbserver hangs after stdin is closed while it tries to
write: "Remote side has terminated connection.  GDBserver will reopen
the connection." This hang disappears if --once is also given. Since
the stdin connection won't ever reopen if it's closed, it's safe to
assume --once is desired.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29796
---
 gdbserver/server.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 789af36d9a4..3ab7a1eed14 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -4204,6 +4204,10 @@ captured_main (int argc, char *argv[])
 	  /* "-" specifies a stdio connection and is a form of port
 	     specification.  */
 	  port = STDIO_CONNECTION_NAME;
+
+	  /* Implying --once here prevents a hang after stdin has been closed.  */
+	  run_once = true;
+
 	  next_arg++;
 	  break;
 	}
-- 
2.45.1


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

end of thread, other threads:[~2024-06-03 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 21:15 [PATCH] [gdbserver] Imply --once if connecting via stdio William Ferreira
2024-05-31 16:04 ` Guinevere Larsen
2024-06-03 15:25 ` Andrew Burgess

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