This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Workaround for 10970, 12702, avoid calling waitpid
On Wednesday 18 May 2011 18:13:11, Jan Kratochvil wrote:
> + if (is_lwp (lp->ptid) && GET_PID (lp->ptid) == GET_LWP (lp->ptid)
> + && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
When can is_lwp(lp->ptid) be false?
> + if (pid != 0 && (pid == -1 && errno == ECHILD))
pid != 0 check looks redundant as is. Is it there to
try to make this more readable? IMO, it isn't because
whenever I read this, I'll stop and ponder whether
there's a bug here, due to the redundancy. :-)
FWIW, this looks good to me, but I wonder whether
checking for zombieness after the waitpids wouldn't
avoid a few /proc/ reads in the common case.
The inferior exit code reported to the core/user will be the
exit code of the last LWP that exits, instead of the
leader's exit code. We've stepped out of C realm when
the leader exited, so I'm not sure that matters (or how
to make it be != 0, even).
--
Pedro Alves