This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] remote.c: Ensure that inferior_ptid is on the thread list
- From: Pedro Alves <palves at redhat dot com>
- To: Kevin Buettner <kevinb at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 23 Jul 2015 22:24:48 +0100
- Subject: Re: [PATCH] remote.c: Ensure that inferior_ptid is on the thread list
- Authentication-results: sourceware.org; auth=none
- References: <20150710135020 dot 573a8f6c at pinnacle dot lan> <55A4E1EF dot 7080204 at redhat dot com> <20150718132737 dot 6c7338eb at pinnacle dot lan>
On 07/18/2015 09:27 PM, Kevin Buettner wrote:
> I'm wary about adding an additional check to make sure that nothing
> follows the thread id. It could be that there's something innocuous
> there. That said, if you really want it in there, I'll revise my
> patch again.
We could add a debug log, so that someone working on some
random stub sees the issue early. My thinking is that with the fix
in place, it's easy to miss the stub bug, as the first thread will
usually be the thread that the remote side says is current too.
static ptid_t
remote_current_thread (ptid_t oldpid)
{
struct remote_state *rs = get_remote_state ();
putpkt ("qC");
getpkt (&rs->buf, &rs->buf_size, 0);
if (rs->buf[0] == 'Q' && rs->buf[1] == 'C')
{
char *obuf;
ptid_t res;
res = read_ptid (&rs->buf[2], &obuf);
if (*obuf != '\0' && remote_debug)
{
fprintf_unfiltered (gdb_stdlog,
"warning: garbage after thread id "
"in qC reply\n")
}
return res;
}
else
return oldpid;
}
>
>>> This (consultation of the thread list) is what is done when
>>> inferior_ptid is null_ptid:
>>>
>>> if (ptid_equal (inferior_ptid, null_ptid))
>>> {
>>
>> Would you mind adding a remote_debug log here?
>
> As noted at the outset, I've updated my description. I haven't
> changed this comment in the actual code. Hopefully, that's what
> you want.
>
Oh, I just meant adding something like:
if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
"couldn't determine remote current thread "
"picking first in list.");
here.
> Here's my updated change:
Looks good to me. Thanks!
--
Pedro Alves