* interesting unwind problem with noreturn functions
@ 2006-03-02 15:13 Randolph Chung
2006-03-02 15:15 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Randolph Chung @ 2006-03-02 15:13 UTC (permalink / raw)
To: gdb
i ran across this when debugging gdb on hppa-linux.....
value_from_double calls error() in the case that I was debugging, but if
i break in error(), i get a corrupted backtrace.
(top-gdb) bt
#0 error (
string=0x23d89c "Unexpected type encountered for floating constant.")
at ../../gdb-cvs/gdb/utils.c:645
#1 0x000b848c in value_from_double (type=0x31d9d0,
num=4.9406564584124654e-324) at ../../gdb-cvs/gdb/value.c:1570
#2 0x000b848c in value_from_double (type=0x31d9d0,
num=4.9406564584124654e-324) at ../../gdb-cvs/gdb/value.c:1570
Previous frame identical to this frame (corrupt stack?)
looking into this, it looks like gcc is being a bit too clever for gdb....
000b83dc <value_from_double>:
b83dc: 6b c2 3f d9 stw rp,-14(sp)
b83e0: 6f c3 01 00 stw,ma r3,80(sp)
[...]
b8484: e8 40 08 bc b,l b98e8 <_initialize_values+0xf3c>,rp
b8488: 08 1c 02 5a copy ret0,r26
000b848c <coerce_ref>:
b848c: 6b c2 3f d9 stw rp,-14(sp)
b8490: 6f c4 01 00 stw,ma r4,80(sp)
b8484 is the call to error (through a long branch stub, so the name
looks funny). The return pointer of the call points past
value_from_double into the next function (hppa has a delay slot for
branches, and rp points to .+8 for a branch insn). Since error() is
defined as a noreturn function, I suppose this is a valid thing for gcc
to do, even if it looks a bit weird.
So when you unwind from error(), the hppa frame unwinder tries to unwind
from rp=b848c, which is in a different function from the actual caller,
and the unwinder gets all confused....
I suppose this is not a hppa specific thing, other architectures might
also encounter the same problem. How is it fixed there? Should the
unwinder be storing the PC as RP-offset? (This seems rather ugly, if not
wrong.)
randolph
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: interesting unwind problem with noreturn functions
2006-03-02 15:13 interesting unwind problem with noreturn functions Randolph Chung
@ 2006-03-02 15:15 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2006-03-02 15:15 UTC (permalink / raw)
To: Randolph Chung; +Cc: gdb
On Thu, Mar 02, 2006 at 11:13:27PM +0800, Randolph Chung wrote:
> So when you unwind from error(), the hppa frame unwinder tries to unwind
> from rp=b848c, which is in a different function from the actual caller,
> and the unwinder gets all confused....
>
> I suppose this is not a hppa specific thing, other architectures might
> also encounter the same problem. How is it fixed there? Should the
> unwinder be storing the PC as RP-offset? (This seems rather ugly, if not
> wrong.)
Please take a look at frame_unwind_address_in_block.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-02 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02 15:13 interesting unwind problem with noreturn functions Randolph Chung
2006-03-02 15:15 ` Daniel Jacobowitz
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 read-only IMAP folder(s) and NNTP newsgroup(s).