This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] Fix linux_test_for_tracefork for newer kernels


On Sat, Nov 13, 2004 at 05:25:06PM -0500, Daniel Jacobowitz wrote:
> On Fri, Nov 12, 2004 at 05:59:41PM -0500, Daniel Jacobowitz wrote:
> > This patch makes the run-time test for fork tracing a little more robust.
> > In particular, it fixes two things:
> >   - If the test failed in an unexpected way, then two stopped processes
> >     could be left around.
> >   - Waitpid can be interrupted by EINTR.  Kernel 2.6.10-rc1 has some
> >     changes to wait and signal processing, which cause the SIGCHLD
> >     to be received before wait returns.  I don't think there's any
> >     actual bug here, since reissuing the wait works fine.
> > 
> > These changes let my testsuite runs finish without leaving hordes of stopped
> > processes around.  I won't check it in yet, since I haven't tested it on a
> > system where this runtime check should fail; in the meantime, I'm just
> > posting it for comments.  Hopefully I got it right this time!
> 
> Now I've tested it in a couple of other systems.  Here's a revised
> version, with a spurious warning fixed, and one additional improvement:
> on most systems lacking the support, we don't need to fork for the
> runtime test.  This fixes some problems in user-mode-linux, which does
> the most disgusting things with ptrace I have ever encountered.  Wow!
> 
> Barring comments, I'll check this in in a few days.

> 2004-11-12  Daniel Jacobowitz  <dan@debian.org>
> 
> 	* linux-nat.c (my_waitpid): New function.
> 	(linux_test_for_tracefork): Make more robust and verbose.  Take
> 	an ORIGINAL_PID argument and test for PTRACE_SETOPTIONS first.
> 	(linux_supports_tracefork, linux_supports_tracevforkdone): Take a PID
> 	argument.  Update calls to linux_test_for_tracefork.
> 	(linux_enable_event_reporting, child_follow_fork)
> 	(child_insert_fork_catchpoint, child_insert_vfork_catchpoint)
> 	(child_insert_exec_catchpoint): Update calls to
> 	linux_supports_tracefork and linux_supports_tracevforkdone.

I have checked this in.  It fixes a couple of hangs when running the
testsuite, for tests which expect GDB to exit, and it fixes the huge
number of zombies and stopped processes that my system has been
collecting every test run.

-- 
Daniel Jacobowitz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]