* [PATCH] sh-tdep.c update to real size of saved_regs[]
@ 2002-02-07 19:01 Elena Zannoni
2002-02-07 19:09 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2002-02-07 19:01 UTC (permalink / raw)
To: gdb-patches
The array saved_regs is now NUM_REGS + NUM_PSEUDO_REGS big.
This patches updates things accordingly.
Elena
2002-02-07 Elena Zannoni <ezannoni@redhat.com>
* sh-tdep.c (sh_nofp_frame_init_saved_regs): Extend where[] array
to include space for pseudoregs as well. Update loops accordingly.
(sh_fp_frame_init_saved_regs): Ditto.
(sh_init_extra_frame_info, sh_pop_frame): Split long lines.
Index: sh-tdep.c
===================================================================
RCS file: /cvs/uberbaum/gdb/sh-tdep.c,v
retrieving revision 1.47
diff -u -p -r1.47 sh-tdep.c
--- sh-tdep.c 2002/01/23 04:00:55 1.47
+++ sh-tdep.c 2002/02/08 02:59:48
@@ -484,7 +484,7 @@ sh_find_callers_reg (struct frame_info *
static void
sh_nofp_frame_init_saved_regs (struct frame_info *fi)
{
- int where[NUM_REGS];
+ int where[NUM_REGS + NUM_PSEUDO_REGS];
int rn;
int have_fp = 0;
int depth;
@@ -511,7 +511,7 @@ sh_nofp_frame_init_saved_regs (struct fr
fi->extra_info->leaf_function = 1;
fi->extra_info->f_offset = 0;
- for (rn = 0; rn < NUM_REGS; rn++)
+ for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
where[rn] = -1;
depth = 0;
@@ -572,7 +572,7 @@ sh_nofp_frame_init_saved_regs (struct fr
/* Now we know how deep things are, we can work out their addresses */
- for (rn = 0; rn < NUM_REGS; rn++)
+ for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
{
if (where[rn] >= 0)
{
@@ -626,7 +626,7 @@ dr_reg_base_num (int dr_regnum)
static void
sh_fp_frame_init_saved_regs (struct frame_info *fi)
{
- int where[NUM_REGS];
+ int where[NUM_REGS + NUM_PSEUDO_REGS];
int rn;
int have_fp = 0;
int depth;
@@ -654,7 +654,7 @@ sh_fp_frame_init_saved_regs (struct fram
fi->extra_info->leaf_function = 1;
fi->extra_info->f_offset = 0;
- for (rn = 0; rn < NUM_REGS; rn++)
+ for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
where[rn] = -1;
depth = 0;
@@ -726,7 +726,7 @@ sh_fp_frame_init_saved_regs (struct fram
/* Now we know how deep things are, we can work out their addresses */
- for (rn = 0; rn < NUM_REGS; rn++)
+ for (rn = 0; rn < NUM_REGS + NUM_PSEUDO_REGS; rn++)
{
if (where[rn] >= 0)
{
@@ -743,7 +743,8 @@ sh_fp_frame_init_saved_regs (struct fram
if (have_fp)
{
- fi->saved_regs[SP_REGNUM] = read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
+ fi->saved_regs[SP_REGNUM] =
+ read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
}
else
{
@@ -772,7 +773,8 @@ sh_init_extra_frame_info (int fromleaf,
by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
SP_REGNUM);
- fi->extra_info->return_pc = generic_read_register_dummy (fi->pc, fi->frame,
+ fi->extra_info->return_pc = generic_read_register_dummy (fi->pc,
+ fi->frame,
PC_REGNUM);
fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
fi->extra_info->leaf_function = 0;
@@ -781,7 +783,8 @@ sh_init_extra_frame_info (int fromleaf,
else
{
FRAME_INIT_SAVED_REGS (fi);
- fi->extra_info->return_pc = sh_find_callers_reg (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
+ fi->extra_info->return_pc =
+ sh_find_callers_reg (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
}
}
@@ -817,9 +820,10 @@ sh_pop_frame (void)
FRAME_INIT_SAVED_REGS (frame);
/* Copy regs from where they were saved in the frame */
- for (regnum = 0; regnum < NUM_REGS; regnum++)
+ for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
if (frame->saved_regs[regnum])
- write_register (regnum, read_memory_integer (frame->saved_regs[regnum], 4));
+ write_register (regnum,
+ read_memory_integer (frame->saved_regs[regnum], 4));
write_register (PC_REGNUM, frame->extra_info->return_pc);
write_register (SP_REGNUM, fp + 4);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sh-tdep.c update to real size of saved_regs[]
2002-02-07 19:01 [PATCH] sh-tdep.c update to real size of saved_regs[] Elena Zannoni
@ 2002-02-07 19:09 ` Andrew Cagney
2002-02-07 20:33 ` Elena Zannoni
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-02-07 19:09 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
> {
> - int where[NUM_REGS];
> + int where[NUM_REGS + NUM_PSEUDO_REGS];
>
BTW, that needs to be:
int *where = alloca (....);
as the above is a GCCism :-(.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sh-tdep.c update to real size of saved_regs[]
2002-02-07 19:09 ` Andrew Cagney
@ 2002-02-07 20:33 ` Elena Zannoni
0 siblings, 0 replies; 3+ messages in thread
From: Elena Zannoni @ 2002-02-07 20:33 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Elena Zannoni, gdb-patches
Andrew Cagney writes:
> > {
> > - int where[NUM_REGS];
> > + int where[NUM_REGS + NUM_PSEUDO_REGS];
> >
> BTW, that needs to be:
>
>
> int *where = alloca (....);
>
> as the above is a GCCism :-(.
>
> Andrew
>
>
Ah! Thanks.
Will fix asap.
Elena
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-02-08 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-07 19:01 [PATCH] sh-tdep.c update to real size of saved_regs[] Elena Zannoni
2002-02-07 19:09 ` Andrew Cagney
2002-02-07 20:33 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox