Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: Jim Blandy <jimb@red-bean.com>
Cc: gdb@sources.redhat.com
Subject: Re: Argument pointers, dwarf and prologue analysis
Date: Mon, 21 Nov 2005 10:32:00 -0000	[thread overview]
Message-ID: <4381A22B.20707@tausq.org> (raw)
In-Reply-To: <8f2776cb0511202342k23a2e537pe3cbf569a94c3d03@mail.gmail.com>

> It seems to me that the real problem is that the Dwarf debugging info
> doesn't accurately describe where the bar's arguments live after the
> call to foo.  That is, when you return from foo, since r20 is
> caller-saved, its value is unknown, and it's incorrect for the
> debugging info to claim that the debugger can find the variables
> relative to its value.

Yeah, I filed a gcc bug about this yesterday....

> I don't think that the wacky idea about recovering r20's value by
> looking at the call site will work.  I mean, if r20 is a scratch
> register, you have no way of knowing that it hasn't been used for
> something else since the function was entered, right?  I admit I don't
> really understand that.

Well, for gcc, preceeding every call will be a setting of the argument 
pointer is a relative offset to the stack pointer. We only need to know 
the value of r29 and r20 during the prologue, so I would argue that if 
we know the value of r29 immediately before the call (at the call site), 
then prologue analysis will be able to tell you where the arguments are 
stored.

that is, there will always be:

caller:
	...
	ldo -48(%sp), %r29
	...
	bl callee, %r2

callee:
	...
	ldo -64(%r29), %r20
	stw %arg0, 4(%r20)
	...
	<after prologue insns>

randolph


  reply	other threads:[~2005-11-21 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-21  5:50 Randolph Chung
2005-11-21  7:42 ` Jim Blandy
2005-11-21 10:32   ` Randolph Chung [this message]
2005-11-21 14:08     ` Daniel Jacobowitz
2005-11-21 15:11       ` Randolph Chung
2005-11-21 15:26         ` Daniel Jacobowitz
2005-11-22  0:07           ` Randolph Chung
2005-11-22  5:15             ` Jim Blandy
2005-11-22  6:39               ` Randolph Chung

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=4381A22B.20707@tausq.org \
    --to=randolph@tausq.org \
    --cc=gdb@sources.redhat.com \
    --cc=jimb@red-bean.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