Re: [PATCH] gdb/remote: Don't use vKill if multi-process features are disabled

Pedro Alves
2016-03-18T00:12:59Z

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;"))
{

Thanks,
Pedro Alves