aboutsummaryrefslogtreecommitdiff
path: root/gdb/v850-tdep.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-05-16 08:23:21 +0000
committerCorinna Vinschen <corinna@vinschen.de>2002-05-16 08:23:21 +0000
commit3a06899a961edc2d09efd644816d91018435bbcd (patch)
tree8291c8768035b7a772fbe75c976c574f239c9eb9 /gdb/v850-tdep.c
parent629936c5b1a54efca1799cd95161d47ae6300572 (diff)
downloadgdb-3a06899a961edc2d09efd644816d91018435bbcd.zip
gdb-3a06899a961edc2d09efd644816d91018435bbcd.tar.gz
gdb-3a06899a961edc2d09efd644816d91018435bbcd.tar.bz2
* v850-tdep.c: Fix comment for v850_scan_prologue. Remove extra
frame info. Use frame_info's saved_regs instead of matching member in extra_frame_info throughout. (v850_frame_init_saved_regs): New function. (v850_init_extra_frame_info): Move most functionality into v850_frame_init_saved_regs(). * config/v850/tm-v850.h (EXTRA_FRAME_INFO): Remove definition. (v850_frame_find_saved_regs): Remove declaration. (FRAME_FIND_SAVED_REGS): Remove definition. (v850_frame_init_saved_regs): Add declaration. (FRAME_INIT_SAVED_REGS): Add definition.
Diffstat (limited to 'gdb/v850-tdep.c')
-rw-r--r--gdb/v850-tdep.c83
1 files changed, 51 insertions, 32 deletions
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 2bc76f5..54a9fdf 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -285,12 +285,12 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi,
/* Function: scan_prologue
Scan the prologue of the function that contains PC, and record what
- we find in PI. PI->fsr must be zeroed by the called. Returns the
- pc after the prologue. Note that the addresses saved in pi->fsr
- are actually just frame relative (negative offsets from the frame
- pointer). This is because we don't know the actual value of the
- frame pointer yet. In some circumstances, the frame pointer can't
- be determined till after we have scanned the prologue. */
+ we find in PI. Returns the pc after the prologue. Note that the
+ addresses saved in frame->saved_regs are just frame relative (negative
+ offsets from the frame pointer). This is because we don't know the
+ actual value of the frame pointer yet. In some circumstances, the
+ frame pointer can't be determined till after we have scanned the
+ prologue. */
static CORE_ADDR
v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
@@ -536,6 +536,46 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
return current_pc;
}
+void
+v850_frame_init_saved_regs (struct frame_info *fi)
+{
+ struct prologue_info pi;
+ struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
+ CORE_ADDR func_addr, func_end;
+
+ if (!fi->saved_regs)
+ {
+ frame_saved_regs_zalloc (fi);
+
+ /* The call dummy doesn't save any registers on the stack, so we
+ can return now. */
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ return;
+
+ /* Find the beginning of this function, so we can analyze its
+ prologue. */
+ if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end))
+ {
+ pi.pifsrs = pifsrs;
+
+ v850_scan_prologue (fi->pc, &pi);
+
+ if (!fi->next && pi.framereg == SP_REGNUM)
+ fi->frame = read_register (pi.framereg) - pi.frameoffset;
+
+ for (pifsr = pifsrs; pifsr->framereg; pifsr++)
+ {
+ fi->saved_regs[pifsr->reg] = pifsr->offset + fi->frame;
+
+ if (pifsr->framereg == SP_REGNUM)
+ fi->saved_regs[pifsr->reg] += pi.frameoffset;
+ }
+ }
+ /* Else we're out of luck (can't debug completely stripped code).
+ FIXME. */
+ }
+}
+
/* Function: init_extra_frame_info
Setup the frame's frame pointer, pc, and frame addresses for saved
registers. Most of the work is done in scan_prologue().
@@ -553,32 +593,11 @@ void
v850_init_extra_frame_info (struct frame_info *fi)
{
struct prologue_info pi;
- struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
if (fi->next)
fi->pc = FRAME_SAVED_PC (fi->next);
- memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
-
- /* The call dummy doesn't save any registers on the stack, so we can return
- now. */
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
- return;
-
- pi.pifsrs = pifsrs;
-
- v850_scan_prologue (fi->pc, &pi);
-
- if (!fi->next && pi.framereg == SP_REGNUM)
- fi->frame = read_register (pi.framereg) - pi.frameoffset;
-
- for (pifsr = pifsrs; pifsr->framereg; pifsr++)
- {
- fi->fsr.regs[pifsr->reg] = pifsr->offset + fi->frame;
-
- if (pifsr->framereg == SP_REGNUM)
- fi->fsr.regs[pifsr->reg] += pi.frameoffset;
- }
+ v850_frame_init_saved_regs (fi);
}
/* Function: frame_chain
@@ -630,8 +649,8 @@ v850_find_callers_reg (struct frame_info *fi, int regnum)
for (; fi; fi = fi->next)
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
- else if (fi->fsr.regs[regnum] != 0)
- return read_memory_unsigned_integer (fi->fsr.regs[regnum],
+ else if (fi->saved_regs[regnum] != 0)
+ return read_memory_unsigned_integer (fi->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum));
return read_register (regnum);
@@ -682,9 +701,9 @@ v850_pop_frame (struct frame_info *frame)
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (frame->fsr.regs[regnum] != 0)
+ if (frame->saved_regs[regnum] != 0)
write_register (regnum,
- read_memory_unsigned_integer (frame->fsr.regs[regnum],
+ read_memory_unsigned_integer (frame->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum)));
write_register (SP_REGNUM, FRAME_FP (frame));