fi->extra_info->framereg = AVR_SP_REGNUM;
if (find_pc_partial_function
- (fi->pc, &name, &prologue_start, &prologue_end))
+ (get_frame_pc (fi), &name, &prologue_start, &prologue_end))
{
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
if (sal.line == 0) /* no line info, use current PC */
- prologue_end = fi->pc;
+ prologue_end = get_frame_pc (fi);
else if (sal.end < prologue_end) /* next line begins after fn end */
prologue_end = sal.end; /* (probably means no prologue) */
}
/* 19 pushes, an add, and "mv fp,sp" */
prologue_end = prologue_start + AVR_MAX_PROLOGUE_SIZE;
- prologue_end = min (prologue_end, fi->pc);
+ prologue_end = min (prologue_end, get_frame_pc (fi));
/* Search the prologue looking for instructions that set up the
frame pointer, adjust the stack pointer, and save registers. */
locals |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
if (memcmp (prologue + vpc + 4, img, sizeof (img)) == 0)
{
- fi->frame = locals;
+ deprecated_update_frame_base_hack (fi, locals);
fi->extra_info->is_main = 1;
return;
if (num_pushes)
{
int from;
- fi->saved_regs[AVR_FP_REGNUM + 1] = num_pushes;
+ get_frame_saved_regs (fi)[AVR_FP_REGNUM + 1] = num_pushes;
if (num_pushes >= 2)
- fi->saved_regs[AVR_FP_REGNUM] = num_pushes - 1;
+ get_frame_saved_regs (fi)[AVR_FP_REGNUM] = num_pushes - 1;
i = 0;
for (from = AVR_LAST_PUSHED_REGNUM + 1 - (num_pushes - 2);
from <= AVR_LAST_PUSHED_REGNUM; ++from)
- fi->saved_regs[from] = ++i;
+ get_frame_saved_regs (fi)[from] = ++i;
}
fi->extra_info->locals_size = loc_size;
fi->extra_info->framesize = loc_size + num_pushes;
if (memcmp (prologue, img, sizeof (img)) == 0)
{
vpc += sizeof (img);
- fi->saved_regs[0] = 2;
- fi->saved_regs[1] = 1;
+ get_frame_saved_regs (fi)[0] = 2;
+ get_frame_saved_regs (fi)[1] = 1;
fi->extra_info->framesize += 3;
}
else if (memcmp (img + 1, prologue, sizeof (img) - 1) == 0)
{
vpc += sizeof (img) - 1;
- fi->saved_regs[0] = 2;
- fi->saved_regs[1] = 1;
+ get_frame_saved_regs (fi)[0] = 2;
+ get_frame_saved_regs (fi)[1] = 1;
fi->extra_info->framesize += 3;
}
}
/* Bits 4-9 contain a mask for registers R0-R32. */
regno = (insn & 0x1f0) >> 4;
++fi->extra_info->framesize;
- fi->saved_regs[regno] = fi->extra_info->framesize;
+ get_frame_saved_regs (fi)[regno] = fi->extra_info->framesize;
scan_stage = 1;
}
else
int reg;
if (fi->next)
- fi->pc = FRAME_SAVED_PC (fi->next);
+ deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (fi->next));
fi->extra_info = (struct frame_extra_info *)
frame_obstack_alloc (sizeof (struct frame_extra_info));
avr_scan_prologue (fi);
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), fi->frame, fi->frame))
{
/* We need to setup fi->frame here because run_stack_dummy gets it wrong
by assuming it's always FP. */
- fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
- AVR_PC_REGNUM);
+ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), fi->frame,
+ AVR_PC_REGNUM));
}
else if (!fi->next) /* this is the innermost frame? */
- fi->frame = read_register (fi->extra_info->framereg);
+ deprecated_update_frame_base_hack (fi, read_register (fi->extra_info->framereg));
else if (fi->extra_info->is_main != 1) /* not the innermost frame, not `main' */
/* If we have an next frame, the callee saved it. */
{
struct frame_info *next_fi = fi->next;
if (fi->extra_info->framereg == AVR_SP_REGNUM)
- fi->frame =
- next_fi->frame + 2 /* ret addr */ + next_fi->extra_info->framesize;
+ deprecated_update_frame_base_hack (fi, next_fi->frame + 2 /* ret addr */ + next_fi->extra_info->framesize);
/* FIXME: I don't analyse va_args functions */
else
{
for (; next_fi; next_fi = next_fi->next)
{
/* look for saved AVR_FP_REGNUM */
- if (next_fi->saved_regs[AVR_FP_REGNUM] && !fp)
- fp = next_fi->saved_regs[AVR_FP_REGNUM];
+ if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM] && !fp)
+ fp = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM];
/* look for saved AVR_FP_REGNUM + 1 */
- if (next_fi->saved_regs[AVR_FP_REGNUM + 1] && !fp1)
- fp1 = next_fi->saved_regs[AVR_FP_REGNUM + 1];
+ if (get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1] && !fp1)
+ fp1 = get_frame_saved_regs (next_fi)[AVR_FP_REGNUM + 1];
}
fp_low = (fp ? read_memory_unsigned_integer (avr_make_saddr (fp), 1)
: read_register (AVR_FP_REGNUM)) & 0xff;
fp_high =
(fp1 ? read_memory_unsigned_integer (avr_make_saddr (fp1), 1) :
read_register (AVR_FP_REGNUM + 1)) & 0xff;
- fi->frame = fp_low | (fp_high << 8);
+ deprecated_update_frame_base_hack (fi, fp_low | (fp_high << 8));
}
}
/* TRoth: Do we want to do this if we are in main? I don't think we should
since return_pc makes no sense when we are in main. */
- if ((fi->pc) && (fi->extra_info->is_main == 0)) /* We are not in CALL_DUMMY */
+ if ((get_frame_pc (fi)) && (fi->extra_info->is_main == 0)) /* We are not in CALL_DUMMY */
{
CORE_ADDR addr;
int i;
/* Resolve a pushed registers addresses */
for (i = 0; i < NUM_REGS; i++)
{
- if (fi->saved_regs[i])
- fi->saved_regs[i] = addr - fi->saved_regs[i];
+ if (get_frame_saved_regs (fi)[i])
+ get_frame_saved_regs (fi)[i] = addr - get_frame_saved_regs (fi)[i];
}
}
}
CORE_ADDR saddr;
struct frame_info *frame = get_current_frame ();
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), frame->frame, frame->frame))
{
generic_pop_dummy_frame ();
}
{
/* Don't forget AVR_SP_REGNUM in a frame_saved_regs struct is the
actual value we want, not the address of the value we want. */
- if (frame->saved_regs[regnum] && regnum != AVR_SP_REGNUM)
+ if (get_frame_saved_regs (frame)[regnum] && regnum != AVR_SP_REGNUM)
{
- saddr = avr_make_saddr (frame->saved_regs[regnum]);
+ saddr = avr_make_saddr (get_frame_saved_regs (frame)[regnum]);
write_register (regnum,
read_memory_unsigned_integer (saddr, 1));
}
- else if (frame->saved_regs[regnum] && regnum == AVR_SP_REGNUM)
+ else if (get_frame_saved_regs (frame)[regnum] && regnum == AVR_SP_REGNUM)
write_register (regnum, frame->frame + 2);
}
static CORE_ADDR
avr_frame_saved_pc (struct frame_info *frame)
{
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
- return deprecated_read_register_dummy (frame->pc, frame->frame,
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), frame->frame, frame->frame))
+ return deprecated_read_register_dummy (get_frame_pc (frame), frame->frame,
AVR_PC_REGNUM);
else
return frame->extra_info->return_pc;
return avr_make_saddr (fi->frame);
}
-/* Given a GDB frame, determine the address of the calling function's frame.
- This will be used to create a new GDB frame struct, and then
- INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+/* Given a GDB frame, determine the address of the calling function's
+ frame. This will be used to create a new GDB frame struct, and
+ then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
+ called for the new frame.
For us, the frame address is its stack pointer value, so we look up
the function prologue to determine the caller's sp value, and return it. */
static CORE_ADDR
avr_frame_chain (struct frame_info *frame)
{
- if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), frame->frame, frame->frame))
{
/* initialize the return_pc now */
frame->extra_info->return_pc
- = deprecated_read_register_dummy (frame->pc, frame->frame,
+ = deprecated_read_register_dummy (get_frame_pc (frame), frame->frame,
AVR_PC_REGNUM);
return frame->frame;
}
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
+ /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+ ready to unwind the PC first (see frame.c:get_prev_frame()). */
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
+
/* If we ever need to differentiate the device types, do it here. */
switch (info.bfd_arch_info->mach)
{
set_gdbarch_max_register_virtual_size (gdbarch, 4);
set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type);
- set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
-
set_gdbarch_print_insn (gdbarch, print_insn_avr);
- set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
- set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address);
set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words);
set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);