This is the mail archive of the gdb@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]

Re: Stepping over fork() turns the child into a zombie


[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


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