Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 1996 13:17:27 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        fhackers@jraynard.demon.co.uk (James Raynard)
Cc:        alk@think.com, jkh@time.cdrom.com, hackers@freebsd.org
Subject:   Re: longstanding, woeful inadeqacy
Message-ID:  <199606272017.NAA05687@phaeton.artisoft.com>
In-Reply-To: <199606270949.JAA00671@jraynard.demon.co.uk> from "James Raynard" at Jun 27, 96 09:49:26 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > : Fork is an easier case since you don't need to swap the debugger's
> > : executable out - just attach to the new process.
> > 
> > Easier in what sense?  It is essentially impossible to debug anything
> > that forks, since by the time you can attach to it, it has gone
> > veering wildly out of control.
> 
> Not if you put a sleep loop in it:-
> 
> int PauseMode = 1;
> 
> if (fork())	/* parent */
> 	....
> else {		/* child */
> 	while (PauseMode)
> 		sleep(5);
> 	...
> }
> 
> and then set PauseMode to 0 when you attach.

Or use vfork and implicitly follow the fork (vfork won't resume the
parent process until the child exits or exec's... this would be more
useful if one could tell which one had occurred without depending
on the inherently unreliable SIGCHLD).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606272017.NAA05687>