public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Alexandra Hájková" <ahajkova@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/6] Add new vDefaultInferiorFd packet
Date: Fri, 17 Nov 2023 14:09:53 +0200	[thread overview]
Message-ID: <83v8a0oa26.fsf@gnu.org> (raw)
In-Reply-To: <20231117111840.2040709-4-ahajkova@redhat.com> (message from Alexandra =?utf-8?B?SMOhamtvdsOh?= on Fri, 17 Nov 2023 12:18:37 +0100)

> From: Alexandra Hájková <ahajkova@redhat.com>
> Cc: ahajkova@redhat.com
> Date: Fri, 17 Nov 2023 12:18:37 +0100
> 
> Add a new DefaultInferiorFd feature and the corresponding packet.
> This feature allows GDB to send, to GDBserver, the file descriptor
> numbers of the terminal to which GDB is connected. The inferior is
> then started connected to the same terminal as GDB. This allows the
> inferior run by local GDBserver to read from GDB's STDIN and write
> its output to GDB's STOUT/ERR the same way as native target.
> ---
>  gdb/doc/gdb.texinfo |  32 +++++++++++
>  gdb/remote.c        |  28 ++++++++++
>  gdbserver/server.cc | 132 +++++++++++++++++++++++++++++++++++++++++++-
>  gdbserver/server.h  |  12 ++++
>  4 files changed, 201 insertions(+), 3 deletions(-)

Thanks.  I have some comments:

> +When GDBserver is run locally using stdio for example
> +@code{target remote | gdbserver - inferior}.
> +Inferior's STDIN is closed which means the inferior can't read any input.

This should be a single sentence, and it currently lacks some
mandatory punctuation and uses sub-optimal markup.  Here's a
suggestion to fix that:

  When GDBserver is run locally using stdio, for example, with
  @w{@kbd{target remote | gdbserver - @var{inferior}}}, the inferior's
  @code{stdin} is closed, which means the inferior can't read any
  input.

> +If GDBserver is run locally using stdio and supports the @xref{default inferior
> +file descriptors} feature, GDBserver will start inferior connected to the same
> +terminal as @value{GDBN} which enables the inferior to read from STDIN and
> +write to the STDOUT/ERR in the same fashion native target does.

Suggest to reword like this:

  If GDBserver supports the default inferior file descriptors feature
  (@pxref{default inferior file descriptors}), it will start the
  inferior connected to the same terminal as @value{GDBN}, which
  enables the inferior to read from @code{stdin} and write to
  @code{stdout} and @code{stderr}, in the same way native targets do.

> +@item vDefaultInferior;@var{fd0};@var{fd1};@var{fd2}
> +@item vDefaultInferiorFd

The second @item should be @itemx.

> +@anchor{default inferior file descriptors}
> +@cindex @samp{vDefaultInferiorFd} packet

Please place the @anchor and the @cindex lines before the @item lines,
so that following the index link will show the @item lines, not only
the text below them.

> +@value{GDBN} would preserve the numbers of STDOUT/STDIN/STDERR file descriptors.
                                              ^^^^^^^^^^^^^^^^^^^
@code{stdin}/@code{stdout}/@code{stderr}

And I don't think I understand why we need to mention that GDB
preserves these file descriptors.  is this important forf using GDB
and gdbserver in these cases?

> +Preserved numbers of the file descriptors are then sent to GDBserver.

Same question about this sentence: is it important, and of so, why?

> +If GDBserver is run locally and will accept the numbers of the file
> +descriptors, it will start the inferior connected to the same STDIN/OUT/ERR
> +@value{GDBN} is connected to. This allows the inferior run under the local GDBserver
> +to read from the STDIN and write to STOUT/ERR. This makes a remote target (which is
> +run locally) to behave similarly to the native target.

I'm confused here: does the above passage describe an alternative way
of starting the inferior?  If so, how is that method useful, and how
can the user control the behavior?

Also, please leave two spaces, not one, between sentences, per our
conventions.

> +This feature does not support setting inferior tty.

What does this mean in practice?  Which commands and/or packets are
not supported, and what does it mean for GDB user in practice?

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

  reply	other threads:[~2023-11-17 12:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 11:18 [PATCH 0/6] Add vDefaultInferiorFd feature Alexandra Hájková
2023-11-17 11:18 ` [PATCH 1/6] gdb.server/non-existing-program.exp: Use gdbserver_start Alexandra Hájková
2023-11-17 11:18 ` [PATCH 2/6] gdb/ser-pipe.c: Duplicate the file descriptors Alexandra Hájková
2023-12-12 19:42   ` Tom Tromey
2023-11-17 11:18 ` [PATCH 3/6] Add new vDefaultInferiorFd packet Alexandra Hájková
2023-11-17 12:09   ` Eli Zaretskii [this message]
2023-12-12 20:03   ` Tom Tromey
2023-11-17 11:18 ` [PATCH 4/6] gdbserver/linux-low.cc: Connect the inferior to the terminal Alexandra Hájková
2023-12-12 20:10   ` Tom Tromey
2023-11-17 11:18 ` [PATCH 5/6] remote.c: Add terminal handling functions Alexandra Hájková
2023-12-12 20:11   ` Tom Tromey
2023-11-17 11:18 ` [PATCH 6/6] Add defaultinf.exp test to the testsuite Alexandra Hájková
2023-11-27 10:01 ` [PATCH 0/6] Add vDefaultInferiorFd feature Alexandra Petlanova Hajkova
2023-12-01 20:22 ` Tom Tromey
2023-12-04 11:08   ` Andrew Burgess
2023-12-04 12:11   ` Alexandra Petlanova Hajkova
2023-12-05 16:00     ` Tom Tromey
2023-12-08 13:06       ` Andrew Burgess
2023-12-12 20:14   ` 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=83v8a0oa26.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=ahajkova@redhat.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).