Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 1996 07:41:23 PDT
From:      "Marty Leisner" <leisner@sdsp.mc.xerox.com>
To:        Tony Kimball <alk@think.com>
Cc:        fhackers@jraynard.demon.co.uk, jkh@time.cdrom.com, hackers@freebsd.org
Subject:   Re: longstanding, woeful inadeqacy 
Message-ID:  <9606281441.AA19546@gnu.mc.xerox.com>
In-Reply-To: Your message of "Thu, 27 Jun 1996 13:30:57 PDT." <199606272030.PAA26920@compound.Think.COM> 

next in thread | previous in thread | raw e-mail | index | archive | help

tracking forks/execs is an old problems...some debuggers I understand
handle this acceptably...

This trick works:


#if 1
/* harmless -- trap fork on an environment to attach debugger */
static int fork_debug(void)
{
        int result;

        result = fork();

        if(result == 0 && getenv("FORKDEBUG")) {
                printf("Child is %d, stopped\n", getpid());
                pause();
        }
        return result;
}
#define fork    fork_debug
#endif


Different OSes need different variants of the pause() -- SunOS works
transparently...

You can put a printf/pause in the target program right after main 
it is execed...

-- 
marty
leisner@sdsp.mc.xerox.com  
Member of the League for Programming Freedom





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