public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: William Ferreira <wqferr@gmail.com>, gdb-patches@sourceware.org
Cc: William Ferreira <wqferr@gmail.com>
Subject: Re: [PATCH] [gdbserver] Imply --once if connecting via stdio
Date: Mon, 03 Jun 2024 16:25:03 +0100	[thread overview]
Message-ID: <874jaaxd4g.fsf@redhat.com> (raw)
In-Reply-To: <20240524211541.378520-1-wqferr@gmail.com>

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


      parent reply	other threads:[~2024-06-03 15:25 UTC|newest]

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

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=874jaaxd4g.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=wqferr@gmail.com \
    /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).