From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Call FRAME_INIT_SAVED_REGS instead of mips_find_saved_regs
Date: Thu, 08 Aug 2002 17:11:00 -0000 [thread overview]
Message-ID: <1020809001129.ZM26138@localhost.localdomain> (raw)
The patch below replaces calls to mips_find_saved_regs with calls to
FRAME_INIT_SAVED_REGS.
It should be noted that FRAME_INIT_SAVED_REGS invokes
mips_find_saved_regs. FRAME_INIT_SAVED_REGS also makes sure that
frame->saved_regs[SP_REGNUM] is set. (I don't know why the author of
mips_find_saved_regs didn't do it there.)
The fact that frame->saved_regs[SP_REGNUM] is setup in
FRAME_INIT_SAVED_REGS has important implications for my rewrite of
mips_get_saved_register(). In the rewrite, I've changed
mips_get_saved_register() to call frame_register_unwind() instead of
the soon-to-be-defunct find_saved_register(). Now
find_saved_register() looped through frames calling
FRAME_INIT_SAVED_REGS() unconditionally. This meant that
frame->saved_regs[SP_REGNUM] would always be set up, regardless of
the means by which frame->saved_regs had been initialized.
frame_register_unwind() and company doesn't unconditionally call
FRAME_INIT_SAVED_REGS(). Instead, it assumes if the saved_regs field
has been allocated (i.e, it's non-zero), then nothing more needs to be
done. I think this is a reasonable assumption. In order to make this
assumption hold for mips, we need to visit all of the other code paths
which might potentially initialize saved_regs and make sure that
they also fill in the correct value for SP_REGNUM. If this is not
done, then the SP value ends up being incorrect for many frames.
There is still one more code path which needs to be fixed in this
regard, but I'm submitting a patch for that separately. (Stay tuned.)
In the course of multiarching FRAME_INIT_SAVED_REGS, I did consider
adding the necessary bits of code for setting
frame->saved_regs[SP_REGNUM] in mips_find_saved_regs, but decided it
would be more obvious if I did a straightforward translation of the
(now replaced) macro. The elimination of mips_find_saved_regs() can
wait for another day. After this patch though, there'll only be one
caller, so it'll be easier to merge mips_find_saved_regs into
mips_frame_init_saved_regs().
Okay to commit?
* mips-tdep.c (read_next_frame_reg): Call FRAME_INIT_SAVED_REGS
instead of mips_find_saved_regs.
* (mips_pop_frame): Likewise.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.93
diff -u -p -r1.93 mips-tdep.c
--- mips-tdep.c 8 Aug 2002 23:32:52 -0000 1.93
+++ mips-tdep.c 8 Aug 2002 23:42:57 -0000
@@ -1466,7 +1466,7 @@ read_next_frame_reg (struct frame_info *
else
{
if (fi->saved_regs == NULL)
- mips_find_saved_regs (fi);
+ FRAME_INIT_SAVED_REGS (fi);
if (fi->saved_regs[regno])
return read_memory_integer (ADDR_BITS_REMOVE (fi->saved_regs[regno]), MIPS_SAVED_REGSIZE);
}
@@ -2890,7 +2890,7 @@ mips_pop_frame (void)
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
if (frame->saved_regs == NULL)
- mips_find_saved_regs (frame);
+ FRAME_INIT_SAVED_REGS (frame);
for (regnum = 0; regnum < NUM_REGS; regnum++)
{
if (regnum != SP_REGNUM && regnum != PC_REGNUM
next reply other threads:[~2002-08-09 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-08 17:11 Kevin Buettner [this message]
2002-08-08 21:19 ` Andrew Cagney
2002-08-09 13:37 ` Kevin Buettner
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=1020809001129.ZM26138@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=gdb-patches@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