public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug threads/10095] New: waitpid (xxx, &status, 0) call from gdb may hang
@ 2009-04-23 22:10 dje at google dot com
  2009-04-23 22:21 ` [Bug threads/10095] " dje at google dot com
  0 siblings, 1 reply; 2+ messages in thread
From: dje at google dot com @ 2009-04-23 22:10 UTC (permalink / raw)
  To: gdb-prs

[filed so there's a point of reference for discussion of this issue]

If a ptracing parent calls waitpid (xxx, &status, 0) on a child with threads,
the call will hang if the main thread has exited.  xxx may be either pid or -1.

Arguably, it's counterintuitive for such a waitpid call to hang if all threads
are in the zombie state, but that's the kernel's behaviour (in 2.6.24-ish and
2.6.29-ish).  See kernel/exit.c:do_wait,et.al.

Attached is an example to illustrate the problem.

-- 
           Summary: waitpid (xxx, &status, 0) call from gdb may hang
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: threads
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: dje at google dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=10095

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug threads/10095] waitpid (xxx, &status, 0) call from gdb may hang
  2009-04-23 22:10 [Bug threads/10095] New: waitpid (xxx, &status, 0) call from gdb may hang dje at google dot com
@ 2009-04-23 22:21 ` dje at google dot com
  0 siblings, 0 replies; 2+ messages in thread
From: dje at google dot com @ 2009-04-23 22:21 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From dje at google dot com  2009-04-23 22:21 -------
Created an attachment (id=3902)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=3902&action=view)
Example to illustrate the problem

Notice that during the call to linux_thread_alive the 2nd thread has
transitioned from state "T" to "Z".  Later when gdb goes to stop the main
thread (this is all-stop mode) the call to waitpid for the main thread hangs.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10095

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2009-04-23 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 22:10 [Bug threads/10095] New: waitpid (xxx, &status, 0) call from gdb may hang dje at google dot com
2009-04-23 22:21 ` [Bug threads/10095] " dje at google dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).