Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Use "switch_to_thread" more thoroughly on gdbserver
Date: Thu, 21 Sep 2017 15:11:00 -0000	[thread overview]
Message-ID: <db2d505b-7d63-eb15-db06-a4193dac3ec4@redhat.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2017-09-21 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15  4:34 Sergio Durigan Junior
2017-09-15 11:14 ` Pedro Alves
2017-09-15 18:25   ` Sergio Durigan Junior
2017-09-21 15:11     ` Pedro Alves [this message]
2017-09-21 15:42       ` Sergio Durigan Junior
2017-09-26  4:23 ` [PATCH v2] " Sergio Durigan Junior
2017-09-26 12:28   ` Pedro Alves
2017-09-26 16:52     ` Sergio Durigan Junior

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=db2d505b-7d63-eb15-db06-a4193dac3ec4@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /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