From: Tom Tromey <tom@tromey.com>
To: "Alexandra Hájková" <ahajkova@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/6] Add new vDefaultInferiorFd packet
Date: Tue, 12 Dec 2023 13:03:38 -0700 [thread overview]
Message-ID: <87r0jrb339.fsf@tromey.com> (raw)
In-Reply-To: <20231117111840.2040709-4-ahajkova@redhat.com> ("Alexandra =?utf-8?B?SMOhamtvdsOhIidz?= message of "Fri, 17 Nov 2023 12:18:37 +0100")
>>>>> "Alexandra" == Alexandra Hájková <ahajkova@redhat.com> writes:
Alexandra> +@item vDefaultInferior;@var{fd0};@var{fd1};@var{fd2}
I think the packet name is wrong on this line.
Alexandra> +@item vDefaultInferiorFd
Alexandra> +@anchor{default inferior file descriptors}
Alexandra> +@cindex @samp{vDefaultInferiorFd} packet
Alexandra> +@value{GDBN} would preserve the numbers of STDOUT/STDIN/STDERR file descriptors.
Alexandra> +Preserved numbers of the file descriptors are then sent to GDBserver.
Alexandra> +If GDBserver is run locally and will accept the numbers of the file
Alexandra> +descriptors, it will start the inferior connected to the same STDIN/OUT/ERR
Alexandra> +@value{GDBN} is connected to. This allows the inferior run under the local GDBserver
To me, the use of "sent" here makes it sound like this is using the
(obscure) SCM_RIGHTS feature, that lets one send file descriptors over a
socket.
However, it isn't, instead it is invoking gdbserver with some extra file
descriptors already opened, and then telling the server which ones to
use.
I think the text should be reworded to make this more clear.
Alexandra> + /* Returns true if connecting inferior to the same terminal as GDB is
Alexandra> + supported, false otherwise. */
Alexandra> + bool remote_fd_switch_p () const
Alexandra> + { return packet_support (PACKET_vDefaultInferiorFd) == PACKET_ENABLE; }
This seems a little odd to me in that if I set up some kind of 'nc'
bridge and use it to connect to a remote valgrind-gdbserver, it will try
to use the gdb file descriptors but that just won't make sense at all.
I guess I'm wondering if this should try to use whatever mechanism we
came up with for checking if the remote is really remote. I don't
remember if that ended up going in or not.
Alexandra> + if ((m_features.packet_support (PACKET_vDefaultInferiorFd) != PACKET_DISABLE)
Alexandra> + && (rs->remote_desc->fds[0] != -1) && (rs->remote_desc->fds[1] != -1)
Alexandra> + && (rs->remote_desc->fds[2] != -1))
These are over-parenthesized.
Alexandra> +volatile int multi_mode = 0;
I think you can drop the volatile. I suspect that was an artifact of
the old longjmp-based exception system.
Alexandra> @@ -4295,6 +4413,14 @@ process_serial_event (void)
Alexandra> response_needed = true;
Alexandra> char ch = cs.own_buf[0];
Alexandra> + if (deferred_inferior_startup)
Alexandra> + {
Alexandra> + /* Actually start the inferior if not a qSupported or
Alexandra> + vDefaultInferiorFd packet. */
Alexandra> + if (!startswith(cs.own_buf, "qSupported")
Alexandra> + && !startswith(cs.own_buf, "vDefaultInferiorFd"))
Alexandra> + do_deferred_startup ();
Alexandra> + }
I had to read this a few times before I felt like it made sense.
Since there is an ordering dependency here, I think that should be
documented. That is, vDefaultInferiorFd is only accepted after
qSupported and before any other request.
Tom
next prev parent reply other threads:[~2023-12-12 20:03 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
2023-12-12 20:03 ` Tom Tromey [this message]
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=87r0jrb339.fsf@tromey.com \
--to=tom@tromey.com \
--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).