Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site frog.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!cybvax0!frog!john From: john@frog.UUCP (John Woods, Software) Newsgroups: net.lang.c Subject: Re: Error recovery (long) Message-ID: <897@frog.UUCP> Date: Wed, 4-Jun-86 16:28:49 EDT Article-I.D.: frog.897 Posted: Wed Jun 4 16:28:49 1986 Date-Received: Sat, 7-Jun-86 09:20:07 EDT References: <312@uw-nsr.UUCP> <3845@sun.uucp> Distribution: net Organization: Superfrog Heaven [ CRDS, Framingham MA ] Lines: 32 >>While on the subject of compilers, I would like to share two other features >>of this compiler that I find useful. >> >>The first feature is the ability to generate a stack trace ("traceback") >>in the event of a serious error. There are two compiler switches that >>control the amount of information in a traceback. The "-Clineid" switch >>causes the offending line number to be included while the "-Cprocid" switch >>causes the procedure name to be included. > I have occaisionally used a trick for programs which only seem to crash when I am not around to poke through entrails, that of writing a C function that catches signals and prints an admittedly-crude stack backtrace. While it is probably nicer to have compiler assist in doing this (I can remember the reams of output that a student-oriented ALGOL-60 interpreter once gave), I still find that if I need much more than the hint that this little backtrace routine of mine gives, I need all of a debugger, anyway. By the way, my backtracer is written entirely in C, with the exception of a call on an assembly routine getfp(), which returns the current frame-pointer value. Which, by the way, is another function with a problematical type: it returns a pointer to a --\ ^ | \______________/ ... (I could have cheated on the getfp() by using the address of a parameter, but as long as I had the RIGHT tool...) -- John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101 ...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc@MIT-XX.ARPA "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining." Jeff Raskin, interviewed in Doctor Dobb's Journal