This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[framebase branch] Make d10v's frame ID constant
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 30 Mar 2003 22:58:29 -0500
- Subject: [framebase branch] Make d10v's frame ID constant
Hello,
This patch changes the d10v so that its frame id is constant. Part of
this means stopping a prologue analysis at the frame's current instruction.
It also converts two FRAME_ARGS_ADDRESS() methods to
get_frame_args_address().
committed to the framebase branch,
Andrew
2003-03-30 Andrew Cagney <cagney at redhat dot com>
* findvar.c (read_var_value): Use get_frame_args_address.
* d10v-tdep.c (d10v_gdbarch_init): Do not set fp_regnum.
(D10V_FP_REGNUM): Rename _FP_REGNUM and FP_REGNUM.
(struct d10v_unwind_cache): Add the fields "prev_sp" and
"this_func". Update comment for base.
(d10v_frame_unwind_cache): Set "prev_sp" and "this_func".
(d10v_frame_this_id): Use the previous frame's inner most stack
address and this frame's func address for the frame ID. Use
frame_id_build. Don't analyze beyond the current instruction.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.90.2.2
diff -u -r1.90.2.2 d10v-tdep.c
--- d10v-tdep.c 30 Mar 2003 16:35:20 -0000 1.90.2.2
+++ d10v-tdep.c 31 Mar 2003 03:42:44 -0000
@@ -69,7 +69,7 @@
{
R0_REGNUM = 0,
R3_REGNUM = 3,
- _FP_REGNUM = 11,
+ D10V_FP_REGNUM = 11,
LR_REGNUM = 13,
_SP_REGNUM = 15,
PSW_REGNUM = 16,
@@ -346,7 +346,7 @@
{
if (reg_nr == PC_REGNUM)
return builtin_type_void_func_ptr;
- if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM)
+ if (reg_nr == _SP_REGNUM || reg_nr == D10V_FP_REGNUM)
return builtin_type_void_data_ptr;
else if (reg_nr >= A0_REGNUM
&& reg_nr < (A0_REGNUM + NR_A_REGS))
@@ -599,7 +599,12 @@
struct d10v_unwind_cache
{
CORE_ADDR return_pc;
- /* The frame's base. Used when constructing a frame ID. */
+ /* The previous frame's inner most stack address. Used as this
+ frame ID's stack_addr. */
+ CORE_ADDR prev_sp;
+ /* The function that belongs to this frame. */
+ CORE_ADDR this_func;
+ /* The frame's base, optionally used by the high-level debug info. */
CORE_ADDR base;
int size;
CORE_ADDR *saved_regs;
@@ -716,10 +721,13 @@
info->return_pc = 0;
info->sp_offset = 0;
- pc = get_pc_function_start (frame_pc_unwind (next_frame));
+ info->this_func = get_pc_function_start (frame_pc_unwind (next_frame));
+ pc = info->this_func;
info->uses_frame = 0;
- while (1)
+ for (pc = info->this_func;
+ pc < frame_pc_unwind (next_frame);
+ pc += 4)
{
op = (unsigned long) read_memory_integer (pc, 4);
if ((op & 0xC0000000) == 0xC0000000)
@@ -766,7 +774,6 @@
|| !prologue_find_regs (info, op2, pc))
break;
}
- pc += 4;
}
info->size = -info->sp_offset;
@@ -777,7 +784,7 @@
/* The SP was moved to the FP. This indicates that a new frame
was created. Get THIS frame's FP value by unwinding it from
the next frame. */
- frame_unwind_unsigned_register (next_frame, FP_REGNUM, &this_base);
+ frame_unwind_unsigned_register (next_frame, D10V_FP_REGNUM, &this_base);
/* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */
prev_sp = this_base + info->size;
@@ -800,14 +807,14 @@
}
info->base = d10v_make_daddr (this_base);
- prev_sp = d10v_make_daddr (prev_sp);
+ info->prev_sp = d10v_make_daddr (prev_sp);
/* Adjust all the saved registers so that they contain addresses and
not offsets. */
for (i = 0; i < NUM_REGS - 1; i++)
if (info->saved_regs[i])
{
- info->saved_regs[i] = (prev_sp + info->saved_regs[i]);
+ info->saved_regs[i] = (info->prev_sp + info->saved_regs[i]);
}
if (info->saved_regs[LR_REGNUM])
@@ -826,7 +833,7 @@
/* The SP_REGNUM is special. Instead of the address of the SP, the
previous frame's SP value is saved. */
- info->saved_regs[SP_REGNUM] = prev_sp;
+ info->saved_regs[SP_REGNUM] = info->prev_sp;
return info;
}
@@ -953,7 +960,7 @@
static CORE_ADDR
d10v_read_fp (void)
{
- return (d10v_make_daddr (read_register (FP_REGNUM)));
+ return (d10v_make_daddr (read_register (D10V_FP_REGNUM)));
}
/* When arguments must be pushed onto the stack, they go on in reverse
@@ -1451,9 +1458,6 @@
CORE_ADDR base;
CORE_ADDR pc;
- /* Start with a NULL frame ID. */
- (*this_id) = null_frame_id;
-
/* The PC is easy. */
pc = frame_pc_unwind (next_frame);
@@ -1465,7 +1469,7 @@
/* Hopefully the prologue analysis either correctly determined the
frame's base (which is the SP from the previous frame), or set
that base to "NULL". */
- base = info->base;
+ base = info->prev_sp;
if (base == STACK_START || base == 0)
return;
@@ -1479,8 +1483,7 @@
&& get_frame_id (next_frame).base == base)
return;
- this_id->base = base;
- this_id->pc = pc;
+ (*this_id) = frame_id_build (base, pc);
}
static void
@@ -1647,7 +1650,6 @@
set_gdbarch_num_regs (gdbarch, d10v_num_regs);
set_gdbarch_sp_regnum (gdbarch, 15);
- set_gdbarch_fp_regnum (gdbarch, 11);
set_gdbarch_pc_regnum (gdbarch, 18);
set_gdbarch_register_name (gdbarch, d10v_register_name);
set_gdbarch_register_size (gdbarch, 2);
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.52.4.1
diff -u -r1.52.4.1 findvar.c
--- findvar.c 26 Mar 2003 20:33:47 -0000 1.52.4.1
+++ findvar.c 31 Mar 2003 03:42:44 -0000
@@ -508,7 +508,7 @@
case LOC_ARG:
if (frame == NULL)
return 0;
- addr = FRAME_ARGS_ADDRESS (frame);
+ addr = get_frame_args_address (frame);
if (!addr)
return 0;
addr += SYMBOL_VALUE (var);
@@ -520,7 +520,7 @@
CORE_ADDR argref;
if (frame == NULL)
return 0;
- argref = FRAME_ARGS_ADDRESS (frame);
+ argref = get_frame_args_address (frame);
if (!argref)
return 0;
argref += SYMBOL_VALUE (var);