From mboxrd@z Thu Jan 1 00:00:00 1970 From: lm@bitmover.com (Larry McVoy) Date: Sat, 2 Oct 2010 14:03:46 -0700 Subject: [TUHS] PDP-8 (was: 2.11BSD cross compiler) In-Reply-To: <20101002034601.GE66070@dereel.lemis.com> References: <20100929005148.GA8032@bitmover.com> <20100929023819.GA12919@bitmover.com> <20100930042229.GA66070@dereel.lemis.com> <20100930135029.GB30928@bitmover.com> <20101002034601.GE66070@dereel.lemis.com> Message-ID: <20101002210346.GE27937@bitmover.com> > > If you could look at the stack frames and give me a stack trace > > that's more or less the same thing. > > (gdb) bt > > The real question is not to get a stack trace, but to analyse it. Hmm, we seem to have a different view. I like people who can write the gdb bt code, not run it. This isn't an imaginary thing, one of my guys showed up one day with his own hand rolled backtrace that we ended up putting in our product for support. The advantage of his, over the following hack we had before, was that it worked when no gdb was installed (windows): void gdb_backtrace(void) { FILE *f; char *cmd; unless (getenv("_BK_BACKTRACE")) return; unless ((f = efopen("BK_TTYPRINTF")) || (f = fopen(DEV_TTY, "w"))) { f = stderr; } cmd = aprintf("gdb -batch -ex backtrace '%s/bk' %u 1>&%d 2>&%d", bin, getpid(), fileno(f), fileno(f)); system(cmd); free(cmd); if (f != stderr) fclose(f); } -- --- Larry McVoy lm at bitmover.com http://www.bitkeeper.com