Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Daniel, thread vs. fork question.
@ 2004-03-11  1:08 Michael Snyder
  2004-03-19  0:09 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Michael Snyder @ 2004-03-11  1:08 UTC (permalink / raw)
  To: Daniel Jacobowitz, gdb-patches

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.

Michael




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-03-23 20:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-11  1:08 Daniel, thread vs. fork question Michael Snyder
2004-03-19  0:09 ` Daniel Jacobowitz
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox