From: Daniel Jacobowitz <drow@mvista.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Daniel, thread vs. fork question.
Date: Thu, 11 Mar 2004 01:51:00 -0000 [thread overview]
Message-ID: <20040311015126.GA17829@nevyn.them.org> (raw)
Message-ID: <20040311015100.ploLXmrr6NzppYoJYvOvUlYnHnwPedRszNimUKBEBo0@z> (raw)
In-Reply-To: <404FBC18.4090909@redhat.com>
On Thu, Mar 11, 2004 at 01:08:40AM +0000, Michael Snyder wrote:
> Hey Daniel,
>
> Got a question concerning the code in
> linux-nat.c::linux_handle_extended_wait.
>
> You've got a PTRACE_EVENT_FORK event, and now you're going to call
> waitpid. You pull a pid out of a list of stopped pids, and wait for
> it using waitpid. In your comment, you explain that you don't have to
> worry about the pid being a clone, because you didn't ask for pids in
> the event mask.
>
> But how is this affected by threads, especially NPTL threads?
> I've got a fairly simple test-case (modified from pthreads.c,
> I'll attach it), in which a child thread calls fork -- but gdb
> apparently tries to wait on the main thread (or perhaps the most
> recent event thread). Since that's not the thread that called
> fork, waitpid returns -1 with "no child". Gdb reports:
> waiting for new child: No child processes.
>
> FWIW, I've tried this on both a single-processor and an SMP machine.
No attachment? Also, what glibc/nptl version are you using.
It's entirely possible that I didn't handle some threaded case. But we
save the PID that we plan to wait on, which should be the child thread,
so I don't see how what you're describing can happn.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2004-03-11 1:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-11 1:08 Michael Snyder
2004-03-19 0:09 ` Daniel Jacobowitz [this message]
2004-03-11 1:51 ` Daniel Jacobowitz
2004-03-19 0:09 ` Michael Snyder
2004-03-11 2:22 ` Michael Snyder
2004-03-19 19:29 ` Michael Snyder
2004-03-19 19:39 ` Daniel Jacobowitz
2004-03-19 0:09 ` Michael Snyder
2004-03-22 17:12 ` Daniel Jacobowitz
2004-03-22 20:20 ` [patch] Fix threads vs. fork following Daniel Jacobowitz
2004-03-23 20:17 ` Michael Snyder
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=20040311015126.GA17829@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
--cc=msnyder@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