From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: drow@false.org
Cc: jimb@codesourcery.com, pgilliam@us.ibm.com, andrew.stubbs@st.com,
brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: [RFC] Move the frame zero PC check earlier
Date: Sat, 20 May 2006 21:30:00 -0000 [thread overview]
Message-ID: <200605202114.k4KLEgYu025968@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20060518233017.GA20777@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 18 May 2006 19:30:17 -0400)
> Date: Thu, 18 May 2006 19:30:17 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Thu, May 18, 2006 at 10:04:09PM +0200, Mark Kettenis wrote:
> > If we're sure that zero return address actually signals the end of the
> > stack, then indeed we should not print the extra frame. I'm not
> > arguing with that. But that's defenitely
>
> Incomplete sentence? But, I think there was enough context.
Think I wanted to say something like:
...not the only case where we see a zero pc.
> > Many systems, but certainly not all systems. At least i386, amd64,
> > sparc and sparc64 don't use this convention.
>
> I hate to break it to you but... that's not 100% true. Most psABI
> documents don't cover clean stack ending, so operating systems often
> have to pick their own (or sometimes they do specify it and OS's go off
> and do their own thing anyway, I expect). I've just checked, and
> sparc-vxworks definitely does end backtraces for kernel mode tasks by
> setting the return address to 0 before it spawns a new task.
Interesting because sparc is one of the few architectures that has a
framepointer register that you can't use for something else, such that
the a "zero framepointer" convention would actually work reliably.
Also not that on sparc we can actually unwind past a zero return
address as long as the frame pointer chain is still intact.
> i386-vxworks sets %ebp to zero to indicate the end of the stack, I
> believe.
This is the traditional way to signal the end of the stack.
Unfortunately GCC's move towards generating framepointer-less code,
makes this convention pretty much useless. On i386, we should
probably move towards setting both %eip and %ebp to zero to indicate
the end of the stack.
> I checked RTEMS too, but the results were somewhat inconclusive; I'm
> not sure it deliberately initializes all registers. That was an
> educational dive through RTOS source, though.
What really matters, is whether the threads library marks the end of
stack properly. For the main thread, we usually end the backtrace at
main() (or its equivalent) and people debugging the startup code that
runs before main() probably now what they're doing.
Mark
next prev parent reply other threads:[~2006-05-20 21:16 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-10 18:03 Daniel Jacobowitz
2006-05-11 10:42 ` Andrew STUBBS
2006-05-11 22:24 ` Jim Blandy
2006-05-11 22:32 ` Daniel Jacobowitz
2006-05-12 6:21 ` Jim Blandy
2006-05-12 12:46 ` Daniel Jacobowitz
2006-05-13 10:14 ` Mark Kettenis
2006-05-13 15:17 ` Daniel Jacobowitz
2006-05-13 15:46 ` Daniel Jacobowitz
2006-05-13 17:08 ` Mark Kettenis
2006-05-13 16:49 ` Mark Kettenis
2006-05-13 18:53 ` Daniel Jacobowitz
2006-05-16 21:38 ` Daniel Jacobowitz
2006-05-16 22:19 ` Mark Kettenis
2006-05-16 22:46 ` Daniel Jacobowitz
2006-05-16 23:53 ` PAUL GILLIAM
2006-05-18 1:35 ` Joel Brobecker
2006-05-18 9:31 ` Jim Blandy
2006-05-18 10:09 ` Andrew STUBBS
2006-05-18 17:36 ` Jim Blandy
2006-05-18 18:09 ` PAUL GILLIAM
2006-05-18 20:04 ` Jim Blandy
2006-05-18 20:43 ` Mark Kettenis
2006-05-18 23:31 ` Jim Blandy
2006-05-20 22:26 ` Mark Kettenis
2006-05-21 2:12 ` Daniel Jacobowitz
2006-07-21 15:52 ` Andrew STUBBS
2006-07-22 11:23 ` Mark Kettenis
2006-07-24 19:32 ` Daniel Jacobowitz
2006-07-26 22:16 ` Mark Kettenis
2006-07-26 22:25 ` Daniel Jacobowitz
2006-05-19 3:32 ` Daniel Jacobowitz
2006-05-20 21:30 ` Mark Kettenis [this message]
2006-05-19 12:26 ` Eli Zaretskii
2006-05-19 18:12 ` Jim Blandy
2006-05-19 18:53 ` Eli Zaretskii
2006-05-22 23:15 ` Jim Blandy
2006-05-15 13:57 ` Andrew STUBBS
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=200605202114.k4KLEgYu025968@elgar.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=andrew.stubbs@st.com \
--cc=brobecker@adacore.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jimb@codesourcery.com \
--cc=pgilliam@us.ibm.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