Subject: Re: Debugging apps with fork()
To: None <dakkon!simmons@life.ai.mit.edu>
From: Mike Long <mike.long@analog.com>
List: netbsd-help
Date: 07/19/1995 12:44:15
>From: "Gerald C. Simmons" <dakkon!simmons@life.ai.mit.edu>
>Date: Tue, 18 Jul 1995 07:09:43 -0700
>
>Now I'm in unfamiliar territory! I'm trying to debug a pop Daemon using gdb.
>Just how do I do that. The program starts, binds itself to the appropriate
>socket, fork()'s itself into the background, and "exits normally." Obviously I
>need the debugger to follow the forked process. How do I do that?

A suggestion I read in the GNU gdb manual is to insert a call to
sleep() after the call to fork(), so that it is called by the child
process before the child does any work.  The sleep() gives you time to
attach gdb to the new process.
-- 
Mike Long <mike.long@analog.com>           http://www.shore.net/~mikel
VLSI Design Engineer         finger mikel@shore.net for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA                assert(*this!=opinionof(Analog));