From owner-freebsd-questions Wed May 22 19:10:58 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id TAA26579 for questions-outgoing; Wed, 22 May 1996 19:10:58 -0700 (PDT) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id TAA26573 for ; Wed, 22 May 1996 19:10:53 -0700 (PDT) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id TAA01038 for ; Wed, 22 May 1996 19:10:22 -0700 (PDT) Received: from bubba.whistle.com(207.76.205.7) by whistle.com via smap (V1.3) id sma001033; Wed May 22 19:09:59 1996 Received: (from archie@localhost) by bubba.whistle.com (8.6.12/8.6.12) id TAA10682 for freebsd-questions@freebsd.org; Wed, 22 May 1996 19:09:58 -0700 From: Archie Cobbs Message-Id: <199605230209.TAA10682@bubba.whistle.com> Subject: stack trace library? To: freebsd-questions@freebsd.org Date: Wed, 22 May 1996 19:09:56 -0700 (PDT) X-Mailer: ELM [version 2.4 PL24] 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 Does there exist a library with routines that a program (linked with -g) can use for doing stack crawls? For example, suppose you signal(SIGSEGV, CatchBug); Then when CatchBug() is called, you want the program to display a stack trace from the point at which the signal occurred, a la gdb's "where" command. Then we could have self debugging programs! :-) CatchBug() might look something like this: extern void StabsSignalTrace(FILE *fp, struct sigcontext *ctx); void CatchBug(int sig, struct sigcontext *ctx) { warnx("caught fatal signal %s", sys_signame[sig]); warnx("please email bug report to xxx@foo.com with this trace:"); StabsSignalTrace(stderr, ctx); exit(1); } If there's no such library, is this possible and/or do-able? -Archie ___________________________________________________________________________ Archie L. Cobbs, archie@whistle.com * Whistle Communications Corporation