* [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
* Re: [PATCH] [gdbserver] Imply --once if connecting via stdio
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
1 sibling, 0 replies; 3+ messages in thread
From: Guinevere Larsen @ 2024-05-31 16:04 UTC (permalink / raw)
To: William Ferreira, gdb-patches
On 5/24/24 18:15, William Ferreira wrote:
> 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
> ---
Hi William!
Thanks for the patch!
Since I helped you develop this patch and its not an area I'm all too
familiar with, I don't think its fair for me to review this patch.
However, I have tested the patch with both native-gdbserver and
native-extended-gdbserver, and I see no regressions, so feel free to add
my tested tag to this!
Tested-By: Guinevere Larsen <blarsen@redhat.com>
--
Cheers,
Guinevere Larsen
She/Her/Hers
> 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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [gdbserver] Imply --once if connecting via stdio
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
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2024-06-03 15:25 UTC (permalink / raw)
To: William Ferreira, gdb-patches; +Cc: William Ferreira
William Ferreira <wqferr@gmail.com> writes:
> 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.
Thanks for working on this.
Ideally it would be nice to have a test added for this. We already have
gdb.server/server-pipe.exp which uses 'target remote | ...', maybe this
test could be extended? Or you could copy this test and change it as
needed?
Let me know if you need additional help writing a test.
Thanks,
Andrew
>
> 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).