This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use "switch_to_thread" more thoroughly on gdbserver
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 21 Sep 2017 16:11:45 +0100
- Subject: Re: [PATCH] Use "switch_to_thread" more thoroughly on gdbserver
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4382BC08EC04
- References: <20170915043357.26094-1-sergiodj@redhat.com> <6f36073a-eed8-123d-94ec-8922aa0aa648@redhat.com> <87r2v7akfz.fsf@redhat.com>
On 09/15/2017 07:25 PM, Sergio Durigan Junior wrote:
> On Friday, September 15 2017, Pedro Alves wrote:
>
>> Do you remember why that check is there in switch_to_thread in the
>> first place, as opposed to, say, an assertion?
>
> I tried to do some archaeology here and find the patch that implemented
> this feature, and it seems to me that the patch always used 'if' instead
> of an 'assert'.
Yeah, gdbserver's switch_to_thread was added with your fork
inferior sharing series.
> Maybe that's because GDB's version of switch_to_thread
> also doesn't assert that ptid != minus_one_ptid...
Except it does:
static void
switch_to_thread (thread_info *thr)
{
gdb_assert (thr != NULL);
^^^^^^^^^^^^^^^^^^^^^^^^
...
Called from:
void
switch_to_thread (ptid_t ptid)
{
if (ptid == null_ptid)
switch_to_no_thread ();
else
switch_to_thread (find_thread_ptid (ptid));
}
... and find_thread_ptid returns NULL because there's
never a thread with ptid == minus_one_ptid.
Thanks,
Pedro Alves