The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: imp@bsdimp.com (M. Warner Losh)
Subject: [TUHS] PDP-8
Date: Sat, 02 Oct 2010 15:39:11 -0600 (MDT)	[thread overview]
Message-ID: <20101002.153911.710852003685317415.imp@bsdimp.com> (raw)
In-Reply-To: <20101002210346.GE27937@bitmover.com>

In message: <20101002210346.GE27937 at bitmover.com>
            Larry McVoy <lm at bitmover.com> writes:
: > > 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);
: }

Stack back traces are easy on x86, but get a lot harder on !x86 at
high optimization layers without help from libunwind.  That's the down
side of not relying on gdb... :)

Warner



  reply	other threads:[~2010-10-02 21:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  5:54 [TUHS] 2.11BSD cross compiler Nick Downing
2010-09-29  0:24 ` Tim Newsham
2010-09-29  0:51   ` Larry McVoy
2010-09-29  2:14     ` John Cowan
2010-09-29  2:38       ` Larry McVoy
2010-09-29  2:59         ` John Cowan
2010-09-29  3:44           ` Larry McVoy
2010-09-30  4:22           ` [TUHS] PDP-8 (was: 2.11BSD cross compiler) Greg 'groggy' Lehey
2010-09-30  4:53             ` John Cowan
2010-09-30 13:50             ` Larry McVoy
2010-10-02  3:46               ` Greg 'groggy' Lehey
2010-10-02 21:03                 ` Larry McVoy
2010-10-02 21:39                   ` M. Warner Losh [this message]
2010-10-02 10:06               ` Wolfgang Helbig
2010-09-29  3:14         ` [TUHS] 2.11BSD cross compiler M. Warner Losh
2010-09-29  3:17         ` Steve Nickolas
2010-09-29  3:55           ` Larry McVoy
2010-09-29  4:34             ` [TUHS] 6502 and swtch, was " Warren Toomey
2010-09-29  5:13               ` Steve Nickolas
2010-09-30 17:49               ` Tim Newsham
2010-09-29 20:54             ` [TUHS] " Peter Jeremy
2010-09-29 21:34               ` Larry McVoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101002.153911.710852003685317415.imp@bsdimp.com \
    --to=imp@bsdimp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).