Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: gdb@sources.redhat.com
Subject: Re: dwarf2 and frame bases
Date: Thu, 11 Nov 2004 03:09:00 -0000	[thread overview]
Message-ID: <20041111000933.GP15714@tausq.org> (raw)
In-Reply-To: <20041110235649.GA741@nevyn.them.org>

> '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/


  reply	other threads:[~2004-11-11  0:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10 23:57 Randolph Chung
2004-11-10 23:58 ` Daniel Jacobowitz
2004-11-11  3:09   ` Randolph Chung [this message]
2004-11-11  9:57     ` Daniel Jacobowitz
2004-11-11 17:12       ` Randolph Chung
2004-11-11 19:42         ` Daniel Jacobowitz
2004-11-11 22:58           ` Randolph Chung
2004-11-11 19:47         ` Mark Kettenis
2004-11-11 21:18           ` 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=20041111000933.GP15714@tausq.org \
    --to=randolph@tausq.org \
    --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