From: Daniel Jacobowitz <drow@false.org>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [non-stop] 08/10 linux native support
Date: Wed, 25 Jun 2008 23:08:00 -0000 [thread overview]
Message-ID: <20080625221220.GB5723@caradoc.them.org> (raw)
In-Reply-To: <200806252217.25796.pedro@codesourcery.com>
On Wed, Jun 25, 2008 at 10:17:25PM +0100, Pedro Alves wrote:
> > This may be trouble. Sometimes the thread state is not
> > atomically updated, so peeking at it right after creation but before
> > an event can fail.
> >
>
> Oh, that's not nice. Is this something that's worth and/or possible
> to fix in libthreaddb?
I don't remember whether it's fixed in current libthread_db, or else
impossible to fix due to the kernel interfaces involved. There's
tension between having the thread on the list early enough and having
its entry be correct. I know I wrote a related kernel patch, which
was never merged. libthread_db is better about this than it used to
be though.
> > Why is it necessary? We already know the ptid since we made them
> > independent of thread_db TID some time ago. attach_thread should cope
> > if the thread is already in GDB's thread list when the event
> > eventually arrives. So we should be able to just add the new
> > thread directly.
>
> That's right, the only thing we'll miss if we do that, is the
> thread_db id of the thread in output like:
>
> [New Thread 0xf7e11b90 (LWP 26100)]
> ^^^^^^^^
> And info threads:
>
> 2 Thread 0xf7e11b90 (LWP 26100) (running)
> ^^^^^^^^
>
> Those will only show up on the next stop event (of any thread).
> It may take a while, if all threads are running (unless we do
> momentarily stop threads trick).
Oh, dear. Options:
- delay the notification until thread_db discovers the thread,
if libthread_db is already active
- display the notification without the thread ID; we'll have the
LWP ID and we could add the GDB thread number
- go with your code and fix broken situations as they arise
I'm undecided. Note that your code is unnecessarily quadratic, by the
way. It'll walk the entire thread list; we could just load the new
thread since we know its LWP ID. libthread_db may still do a walk in
that case though...
> > SIGKILL should work even if the thread is stopped.
>
> I think I'll need a SIGCONT as well in that case. For some
> reason, I wasn't getting that to work all the times. I'll
> experiment some more.
Kernels may vary in this regard. Your code seems reasonable.
PTRACE_KILL is supposed to be just SIGKILL + PTRACE_CONT, and SIGKILL
is supposed to work even on stopped processes, but the details come
and go... as you know, signal handling is a very touchy area and hard
to write tests for.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-06-25 22:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-15 21:10 Pedro Alves
2008-06-25 21:17 ` Daniel Jacobowitz
2008-06-25 22:03 ` Pedro Alves
2008-06-25 22:12 ` Pedro Alves
2008-06-25 22:52 ` Daniel Jacobowitz
2008-06-25 23:08 ` Daniel Jacobowitz [this message]
2008-07-02 3:35 ` Pedro Alves
2008-07-07 18:20 ` Daniel Jacobowitz
2008-07-09 3:25 ` Michael Snyder
2008-07-09 3:47 ` Daniel Jacobowitz
2008-07-09 3:55 ` Michael Snyder
2008-07-09 7:55 ` Mark Kettenis
2008-07-09 7:56 ` Mark Kettenis
2008-07-10 15:28 ` Pedro Alves
2008-07-10 17:15 ` Daniel Jacobowitz
2008-07-10 18:01 ` Pedro Alves
2008-07-10 19:59 ` Daniel Jacobowitz
2008-07-10 21:51 ` Pedro Alves
2008-07-10 22:15 ` Daniel Jacobowitz
2008-07-10 23:01 ` Pedro Alves
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=20080625221220.GB5723@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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