Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 May 1996 11:29:35 -0700 (PDT)
From:      "JULIAN Elischer" <julian@ref.tfs.com>
To:        grog@lemis.de (Greg Lehey)
Cc:        msmith@atrad.adelaide.edu.au, archie@whistle.com, freebsd-questions@freebsd.org
Subject:   Re: stack trace library?
Message-ID:  <199605241829.LAA26349@ref.tfs.com>
In-Reply-To: <199605241533.RAA24145@allegro.lemis.de> from "Greg Lehey" at May 24, 96 12:04:34 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Michael Smith writes:
> >
> > Archie Cobbs stands accused of saying:
> >>
> >> Does there exist a library with routines that a program (linked with -g)
> >> can use for doing stack crawls?
> >
> >
> > Note that it would probably almost as easy to fork off a subprocess, start
> > gdb and attach it to the offending process, run a few commands in it,
> > detach it and exit.
> 
> I think it would be easier.
> 
> I was thinking of doing something like this recently.  One of the
> biggest problems people have in debugging multiple processes is that
> you can't easily debug a process started by another (non-shell)
> process.  Sure, you can attach to the process (wonderful feature!),
> but you can't catch it from the start, and you can't catch it if it
> gets a fatal signal.  It occurred to me that it would be relatively
> simple to add a couple of environment variables, say,
> "START_DEBUGGER" and "TRAP_DEBUGGER".

At TFS we used to replace progra "a" with a shellscript "a"
which would consit of:

#!/bin/sh
cat > .gdbinit <<DONE
#commands to start up the program etc.
./a.real $*
DONE
xterm -e dgb



as for a stactracing utility,
there is a simple routine to do this in the mprof package
it could easily be stolen.

julian



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