This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Stepping over fork() turns the child into a zombie
- To: Orjan Friberg <orjan dot friberg at axis dot com>
- Subject: Re: Stepping over fork() turns the child into a zombie
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 09 May 2001 18:00:42 -0400
- Cc: GDB Discussion <gdb at sources dot redhat dot com>
- References: <3AE05E78.B1DE552A@axis.com>
[changed to gdb discussion]
> I have a toy program that forks. If I step over the call to fork, the
> child immediately becomes a zombie. If I set a breakpoint in the parent
> code and continue past the call to fork, the child process is fine.
> Surprisingly enough, I didn't find anything in the mailing list archives
> about this. I'm running a freshly updated gdb, and
Yes, I've reproduced this behavour but I've no idea's on what the
problem is.
> On a related note, is there a simple way to start debugging of the child
> process? I'm running in an embedded environment where I have a
> gdbserver capable of attaching to a process by means of PTRACE_ATTACH.
> Ideally, I would like to take control of the child process by the time
> it reaches main (or in the library startup routines). I'd rather not
> insert a sleep(30) in the beginning of the child's main function to
> allocate enough time to start a new gdbserver and do the attach. Any
> ideas?
sleep(30) is the standard technique.
H.P. did contribute code to implement ``follow fork()''. Only works on
HP/UX mind.
Andrew