From owner-freebsd-questions Fri May 24 11:30:42 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id LAA13889 for questions-outgoing; Fri, 24 May 1996 11:30:42 -0700 (PDT) Received: from ref.tfs.com (ref.tfs.com [140.145.254.251]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id LAA13880 for ; Fri, 24 May 1996 11:30:39 -0700 (PDT) Received: (from julian@localhost) by ref.tfs.com (8.7.3/8.6.9) id LAA26349; Fri, 24 May 1996 11:29:36 -0700 (PDT) Message-Id: <199605241829.LAA26349@ref.tfs.com> Subject: Re: stack trace library? To: grog@lemis.de (Greg Lehey) Date: Fri, 24 May 1996 11:29:35 -0700 (PDT) From: "JULIAN Elischer" Cc: msmith@atrad.adelaide.edu.au, archie@whistle.com, freebsd-questions@freebsd.org In-Reply-To: <199605241533.RAA24145@allegro.lemis.de> from "Greg Lehey" at May 24, 96 12:04:34 pm X-Mailer: ELM [version 2.4 PL25 ME8b] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > 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 <