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: randolph@tausq.org, brobecker@adacore.com
Subject: Re: [RFC] Modernize HP-UX core file handling
Date: Fri, 17 Dec 2004 06:52:00 -0000	[thread overview]
Message-ID: <200412170243.iBH2hXwX013139@hiauly1.hia.nrc.ca> (raw)

> found where all registers are saved. We know before scanning the
> instrunctions that the SP was saved, but we don't know that the register
> containing the old SP has itself been saved on the stack.

Huh?  GCC uses r3 as the frame pointer.  When a frame pointer is
needed, SAVE_SP is set.  When SAVE_SP is set, current GCC versions
save the old SP at SP-4.  The SP-4 is set in the prologue and whenever
a dynamic stack allocation is performed.  Unfortunately, old versions
of GCC don't correctly save the old SP at SP-4.  However, r3 always
contains the old SP when SAVE_SP is set.  HP compilers don't set
SAVE_SP.  The SP-4 support was added to GCC to fix a problem with
the HP-UX unwind library.

I'm not surprised that gdb didn't see the save at SP-4 as this is
a relatively new GCC feature under HP-UX (this isn't done under linux).
This was for better support of the frame marker.  Note the frame
marker moves in a dynamic stack allocation (i.e, the old SP is always
at SP-4).  Thus, if SAVE_SP is set and you see a save to SP-4 in
the prologue, the old SP can always be found at SP-4.

Since r3 is a callee-saves register, it has to be saved on the stack
when SAVE_SP is set in the unwind info.

Hope that helps.

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-12-17  2:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-17  6:52 John David Anglin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-12-09 23:36 Mark Kettenis
2004-12-10  9:45 ` Randolph Chung
2004-12-10 10:46   ` Mark Kettenis
2004-12-10 15:50   ` Joel Brobecker
2004-12-16 19:53     ` Joel Brobecker
2004-12-16 23:52       ` 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=200412170243.iBH2hXwX013139@hiauly1.hia.nrc.ca \
    --to=dave@hiauly1.hia.nrc.ca \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.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