This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dwarf2 and frame bases


> 'b' is in some particular frame.  It's up the stack from the current
> frame at the time of that error message, I get.  So we should be
> unwinding reg3 and using the unwound copy to determine the value of b.
> Is the unwinding breaking?

but the unwound copy is wrong too... :) i explain more below..

> What's the actual PC at the time of the error?  Is it in the prologue? 
first insn of the prologue.

> Epilogue?  What's the stack pointer - at the time of setting the
> watchpoint, and at the time of the error?

well, the frame_base dwarf descriptor points to r3, but the stack
pointer is actually r30. r3 is the frame pointer.

when compiled without optimization, gcc emits these prologues/epilogues
for each function:

prologue:
    stw rp, -14(%sp)
    copy %r3, %r1
    copy %r30, %r3
    stw,ma %r1, 80(%sp) /* or other frame size)

epilogue:
    ldw -14(%r3), %rp
    ldw,mb -80(%sp), %r3

(remember also that on hppa the frame grows towards higher addresses)

so in the function body, r3 is the frame base. 'b' is at *(r3 + 8)

r3 is also a callee-saved register, so its contents are undefined on
entry to the function. so even if you were to unwind r3, you won't get
the right frame base.

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]