[RFC] Move the frame zero PC check earlier

Daniel Jacobowitz drow@false.org
Fri May 19 03:32:00 GMT 2006


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.

> 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.

i386-vxworks sets %ebp to zero to indicate the end of the stack, I
believe.

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.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list