public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: William Ferreira <wqferr@gmail.com>
To: gdb-patches@sourceware.org
Cc: William Ferreira <wqferr@gmail.com>
Subject: [PATCH] [gdbserver] Imply --once if connecting via stdio
Date: Fri, 24 May 2024 18:15:41 -0300	[thread overview]
Message-ID: <20240524211541.378520-1-wqferr@gmail.com> (raw)

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


             reply	other threads:[~2024-05-24 21:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 21:15 William Ferreira [this message]
2024-05-31 16:04 ` Guinevere Larsen
2024-06-03 15:25 ` Andrew Burgess

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=20240524211541.378520-1-wqferr@gmail.com \
    --to=wqferr@gmail.com \
    --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).