Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: gdb-patches@sources.redhat.com
Cc: tausq@debian.org, cagney@gnu.org
Subject: Re: [patch/rfa/hppa] Use frame pointer for unwinding
Date: Mon, 17 May 2004 17:14:00 -0000	[thread overview]
Message-ID: <200405171713.i4HHDxc1006156@hiauly1.hia.nrc.ca> (raw)

> ok. there is no gcc bug yet, but i will file one.

Bug?

> the fp != 0 is there probably because i don't understand correctly how
> the unwinder is working. if you have three frames:

> frame 3 - unwind from here
> frame 2 - doesn't save fp; fp should be constant in this function
> frame 1 - saves fp

Note that the the previous SP (frame pointer) is saved in the frame
marker of frame 1.  This value is accessible from frame 2 (i.e.,
effectively the frame pointer is always saved under hpux when Save_SP
is true -- it's just done by the caller).  However, I think gdb
should avoid using the saved SP value in the frame marker as not
all versions of GCC support this.  It's also not supported under
linux.

There are basically three situations generated by GCC:

1) The previous SP is saved at the start of the frame, the frame has
   a frame pointer (all alloca frames have a frame pointer) and Save_SP
   is set in the callinfo data.  Under hpux, the previous SP value
   is also saved at SP - 4 (8 on hppa64) in the frame marker.  This
   value is copied when a stack adjustment is done (i.e., the frame
   marker moves).

2) The frame uses register %r3 but doesn't have a frame pointer.  In
   this case, %r3 is saved along with the other general registers.

3) The frame does have a frame pointer or use %r3.  %r3 is not saved
   in the frame.

> frame 3 gets frame 2 as next_frame, will it be able to get the value of
> fp (from what is saved in frame 1)? it seems to work in my tests, but 
> i haven't yet figured out how it works in the code. if frame 2 doesn't
> save a register in its cache, is there some code that by default 
> propagates the values from the next frame?

If frame doesn't save %r3 either using method 1 or 2, then frame 2
leaves %r3 unchanged.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


             reply	other threads:[~2004-05-17 17:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-17 17:14 John David Anglin [this message]
2004-05-17 17:28 ` Randolph Chung
2004-05-17 17:54   ` John David Anglin
  -- strict thread matches above, loose matches on Subject: below --
2004-05-17 16:13 John David Anglin
2004-05-16  2:07 Randolph Chung
2004-05-16 10:36 ` Mark Kettenis
2004-05-16 15:36   ` Randolph Chung
2004-05-16 16:22     ` Mark Kettenis
2004-05-16 16:42       ` Randolph Chung
2004-05-16 16:32 ` Andrew Cagney
2004-05-16 17:03   ` Randolph Chung
2004-05-17  0:13     ` Randolph Chung
2004-05-17  2:34       ` Randolph Chung
2004-05-17 15:23         ` Andrew Cagney
2004-05-17 16:01           ` Randolph Chung
2004-05-17 17:27             ` Andrew Cagney
2004-05-17 15:13     ` Andrew Cagney

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=200405171713.i4HHDxc1006156@hiauly1.hia.nrc.ca \
    --to=dave@hiauly1.hia.nrc.ca \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=tausq@debian.org \
    /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