Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: when can find_thread_pid (inferior_ptid) return NULL?
Date: Thu, 26 Mar 2009 22:35:00 -0000	[thread overview]
Message-ID: <200903262235.10443.pedro@codesourcery.com> (raw)
In-Reply-To: <20090326213642.B9E771C74E3@localhost>

On Thursday 26 March 2009 21:36:42, Doug Evans wrote:
> Hi.  Some places in gdb assert that find_thread_pid (inferior_ptid)
> is never NULL.

> make_cleanup_restore_current_thread:
> 
>       tp = find_thread_pid (inferior_ptid);
>       if (tp)
> 	tp->refcount++;

I think that in this particular case, it will always be true.

> 
> Since delete_thread_1 has this:
> 
>   /* If this is the current thread, or there's code out there that
>      relies on it existing (refcount > 0) we can't delete yet.  Mark
>      it as exited, and notify it.  */
>   if (tp->refcount > 0
>       || ptid_equal (tp->ptid, inferior_ptid))
>     {
> 
> I would expect that one can always assert
> find_thread_pid (inferior_ptid) != NULL.
> 
> Is that true?
> Or are there situations where it's not true?

When inferior_ptid is null_ptid.  You'll also not
find the old ptid if running the cleanup after something
clears the thread list, e.g., after killing or poping the target.

-- 
Pedro Alves


  reply	other threads:[~2009-03-26 22:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 21:36 Doug Evans
2009-03-26 22:35 ` Pedro Alves [this message]
2009-03-27  0:54   ` Doug Evans

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=200903262235.10443.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=dje@google.com \
    --cc=gdb@sourceware.org \
    /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