This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/remote: Don't use vKill if multi-process features are disabled
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 18 Mar 2016 06:27:47 +0000
- Subject: Re: [PATCH] gdb/remote: Don't use vKill if multi-process features are disabled
- Authentication-results: sourceware.org; auth=none
- References: <1458252144-3496-1-git-send-email-andrew dot burgess at embecosm dot com> <56EB2DD1 dot 4090103 at redhat dot com> <20160317232658 dot GY14100 at embecosm dot com> <56EB4806 dot 7070505 at redhat dot com>
* Pedro Alves <palves@redhat.com> [2016-03-18 00:12:54 +0000]:
> On 03/17/2016 11:26 PM, Andrew Burgess wrote:
>
> > The gdb remote protocol documentation is clear that the vKill command
> > should not be used unless the multi-process feature is reported as
> > supported by the remote target.
>
> Sorry, you were too fast... :-/
>
> I recalled a reason to keep it. The original reason for the docs saying
> that is that vKill includes a PID, and without multi-process extensions,
> there's no known non-fake PID to send. (GDB is presently sending a
> fake PID, as you've probably noticed).
>
> The other-than-the-pid advantage of vKill over "k", is that "k" has
> no reply, and thus no way to return error, failure to kill, etc.
>
> Note gdbserver is making use of vKill with multi-process off:
>
> /* Kill process. Return 1 if successful, 0 if failure. */
> static int
> handle_v_kill (char *own_buf)
> {
> int pid;
> char *p = &own_buf[6];
> if (multi_process)
> pid = strtol (p, NULL, 16);
> else
> pid = signal_pid;
> if (pid != 0 && kill_inferior (pid) == 0)
>
> So we could just not include the "pid" part if multi-process
> is off, similar to D vs D;pid. We'd still need the ";", due
> to gdbserver's:
>
> if (startswith (own_buf, "vKill;"))
> {
OK, armed with this new insight I read the docs again, and now I see
that indeed my initial interpretation was not correct. I see if I can
come up with a wording that feels clearer.
Thank you for setting me straight.
Andrew