🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #63000

Re: GDB: following fork?

#63000
From: Tom Tromey
Date: Tue, 28 Mar 1995 20:16
24 lines
1939 bytes
>>>>> "Michael" == Michael Schumacher <hightec@sbusol.rz.uni-sb.de> writes:

Michael> I'm not aware of *any* debugger which could trace child
Michael> processes (this has to do with the memory management of the
Michael> underlying OS). The following hack might be helpful if your
Michael> OS allows to attach to running processes: right after the
Michael> fork, put an endless loop which is controlled by a variable,
Michael> i.e.

Debuggers do exist which can do this.  I wish gdb would.

Another useful trick is to swap the parent and child branches of the
if following the fork.  Then the debugger will trace the "child"
instead of the "parent".

And instead of busy-waiting with a while, you should use sigpause.
Connecting to the running process with a debugger will cause the
sigpause to return.

Tom
--
tromey@cns.caltech.edu                Member, League for Programming Freedom
"Sadism and farce are always inexplicably linked"
	-- Alexander Theroux
Technical Details
Message-ID: <TROMEY.95Mar28121625@kant.klab.caltech.edu>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!fu-berlin.de!news.dfn.de!news.dkrz.de!news.rrz.uni-hamburg.de!unibwh.unibw-hamburg.de!Germany.EU.net!EU.net!howland.reston.ans.net!swrinde!elroy.jpl.nasa.gov!netline-fddi.jpl.nasa.gov!nntp-server.caltech.edu!nntp-server.caltech.edu!tromey
References: <3ka5sr$rpm@serra.unipi.it> <3l8iks$fco@hades.rz.uni-sb.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,e9f1530a634deb70
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1995-03-28 12:16:25 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!fu-berlin.de!news.dfn.de!news.dkrz.de!news.rrz.uni-hamburg.de!unibwh.unibw-hamburg.de!Germany.EU.net!EU.net!howland.reston.ans.net!swrinde!elroy.jpl.nasa.gov!netline-fddi.jpl.nasa.gov!nntp-server.caltech.edu!nntp-server.caltech.edu!tromey
From: tromey@klab.caltech.edu (Tom Tromey)
Newsgroups: gnu.misc.discuss
Subject: Re: GDB: following fork?
Date: 28 Mar 1995 20:16:25 GMT
Organization: California Institute of Technology
Lines: 24
Distribution: world
Message-ID: <TROMEY.95Mar28121625@kant.klab.caltech.edu>
References: <3ka5sr$rpm@serra.unipi.it> <3l8iks$fco@hades.rz.uni-sb.de>
NNTP-Posting-Host: kant.klab.caltech.edu
In-reply-to: hightec@sbusol.rz.uni-sb.de's message of 28 Mar 1995 08:50:36 GMT