This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Call FRAME_INIT_SAVED_REGS instead of mips_find_saved_regs
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Andrew Cagney <ac131313 at ges dot redhat dot com>, Kevin Buettner <kevinb at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 9 Aug 2002 13:37:05 -0700
- Subject: Re: [RFA] Call FRAME_INIT_SAVED_REGS instead of mips_find_saved_regs
- References: <1020809001129.ZM26138@localhost.localdomain> <3D5342DC.7060500@ges.redhat.com>
On Aug 9, 12:19am, Andrew Cagney wrote:
> Subject: Re: [RFA] Call FRAME_INIT_SAVED_REGS instead of mips_find_saved_r
>
> > 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().
>
> Can you please add a comment to mips_find_saved_regs() indicating this.
>
> Otherwize approved.
Committed. For the record, here's what went in:
(Hmm... gotta fix the comment delimiter. I'll do that in a moment.)
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.94
diff -u -p -r1.94 mips-tdep.c
--- mips-tdep.c 9 Aug 2002 01:42:41 -0000 1.94
+++ mips-tdep.c 9 Aug 2002 20:28:30 -0000
@@ -1256,7 +1256,16 @@ mips_next_pc (CORE_ADDR pc)
}
/* Guaranteed to set fci->saved_regs to some values (it never leaves it
- NULL). */
+ NULL).
+
+ Note: kevinb/2002-08-09: The only caller of this function is (and
+ should remain) mips_frame_init_saved_regs(). In fact,
+ aside from calling mips_find_saved_regs(), mips_frame_init_saved_regs()
+ does nothing more than set frame->saved_regs[SP_REGNUM]. These two
+ functions should really be combined and now that there is only one
+ caller, it should be straightforward. (Watch out for multiple returns
+ though.)
+*/
static void
mips_find_saved_regs (struct frame_info *fci)
@@ -1465,7 +1474,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 +2905,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