Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Anderson <davea@quasar.engr.sgi.com>
To: gdb@sources.redhat.com
Subject: MIPS stack tracing
Date: Sat, 02 Feb 2002 10:58:00 -0000	[thread overview]
Message-ID: <200202021858.KAA55020@quasar.engr.sgi.com> (raw)


Don Bowman <don@sandvine.com> writes:
> Now, before I launch into fixing the gdb MIPS stack tracing
> code up, I thought I'd ask a few questions. I'd like to
> do it by using the symbols to find the start of each function,
> instead of by the heuristic of walking in the code. That
> would be much faster for me (I'm on an embedded platform,
> and its slow to walk the memory over the link). It would also
> be deterministic. The downside is that the stack trace won't
> work without a symbol file. Is that OK?

Whether it's ok for gdb is for others  to say.
SGI debuggers long ago went this route.

Daniel Jacobowitz <drow@mvista.com> writes:
|The stack tracing algorithm for MIPS is defined in
|the SYSV ABI, @ http://www.caldera.com/developers/devspecs/
|Its fairly straightforward and works reliably.
|
|The gist of it is, walk backwards until you find 'jr ra',
|then walk forwards to the first non-null instruction. That's
|the start of a function. Look for a [d]addiu to the sp, that's
|the stack adjustment, look for a [d]addiu to the fp, that's
|the frame. Look for a s[w|d] of ra to the stack.
|Continue on up the stack.
|
|However, gcc 3.0 is breaking the rules. It emits multiple
|'jr ra' per function. Unfortunately, this appears to be
|rather tough to fix. The upshot is that the beginning of
|a function can't be reliably found, and it all falls apart
|from there. Prior to gcc 3.0 it was fine.

That ABI document was written for and applies to the MIPS-I
processors available at the time.
AFAIK, the organization that maintained that document disbanded
a few years ago.

As I said in an earlier note, the ABI document was not always honored
(though it should have been) even back in the early 1990's
but today that Mips Processor Supplement is simply
not applicable.  Much has not changed, but key things
have changed (new registers and
new instructions).  I don't know of a replacement document
(other than SGI documents).

http://www.mips.com has the
MIPSpro assembly language document (vol 1 and 2)
which is (or was) an SGI document describing the n32 
calling conventions.   
(you have to register to see the document, but there is no charge).
Also available from http://techpubs.sgi.com

Corrections welcome.
David Anderson davea@sgi.com


             reply	other threads:[~2002-02-02 18:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-02 10:58 David Anderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-02-07  6:56 Don Bowman
2002-02-07  7:30 ` Daniel Jacobowitz
2002-02-06  9:40 Don Bowman
2002-02-06 16:45 ` Daniel Jacobowitz
2002-02-04  9:22 David Anderson
2002-02-03 15:49 Don Bowman
2002-02-03 12:29 Don Bowman
2002-02-03 12:29 ` Daniel Jacobowitz
2002-02-03 12:29   ` Andrew Cagney
2002-02-03 12:13     ` Daniel Jacobowitz
2002-02-03 12:29       ` Andrew Cagney
2002-02-02 12:14 Don Bowman
2002-02-02 14:45 ` Daniel Jacobowitz
2002-02-02 11:26 Don Bowman
2002-02-02 12:11 ` Stan Shebs
2002-02-02  9:57 David Anderson
2002-02-01 10:15 Don Bowman
2002-02-01 11:32 ` Daniel Jacobowitz
2002-02-02 11:16 ` Greg McGary
2002-01-31 14:27 Don Bowman
2002-02-01  9:37 ` Daniel Jacobowitz

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=200202021858.KAA55020@quasar.engr.sgi.com \
    --to=davea@quasar.engr.sgi.com \
    --cc=gdb@sources.redhat.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