* frame.c (frame_func_unwind, get_frame_func): New functions.
* frame.h (get_frame_func, frame_func_unwind): Declare.
(struct frame_info): Add field "prev_func" for caching the
previous frame's function address.
* arm-tdep.c (arm_frameless_function_invocation): Combine
get_pc_function_start and get_frame_pc into get_frame_func.
* sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
(sh64_nofp_frame_init_saved_regs): Ditto.
* s390-tdep.c (s390_function_start): Ditto.
* rs6000-tdep.c (rs6000_pop_frame): Ditto.
(rs6000_frameless_function_invocation): Ditto.
(rs6000_frame_saved_pc): Ditto.
* m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
* ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
* i386-tdep.c (i386_frameless_signal_p): Ditto.
(i386_frame_init_saved_regs): Ditto.
* hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
* d10v-tdep.c (d10v_frame_unwind_cache): Combine
get_pc_function_start and frame_pc_unwind into frame_func_unwind.
* cris-tdep.c (cris_frame_init_saved_regs): Ditto.
* blockframe.c (frameless_look_for_prologue): Ditto.
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (frame_func_unwind, get_frame_func): New functions.
+ * frame.h (get_frame_func, frame_func_unwind): Declare.
+ (struct frame_info): Add field "prev_func" for caching the
+ previous frame's function address.
+ * arm-tdep.c (arm_frameless_function_invocation): Combine
+ get_pc_function_start and get_frame_pc into get_frame_func.
+ * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
+ (sh64_nofp_frame_init_saved_regs): Ditto.
+ * s390-tdep.c (s390_function_start): Ditto.
+ * rs6000-tdep.c (rs6000_pop_frame): Ditto.
+ (rs6000_frameless_function_invocation): Ditto.
+ (rs6000_frame_saved_pc): Ditto.
+ * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
+ * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
+ * i386-tdep.c (i386_frameless_signal_p): Ditto.
+ (i386_frame_init_saved_regs): Ditto.
+ * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
+ * d10v-tdep.c (d10v_frame_unwind_cache): Combine
+ get_pc_function_start and frame_pc_unwind into frame_func_unwind.
+ * cris-tdep.c (cris_frame_init_saved_regs): Ditto.
+ * blockframe.c (frameless_look_for_prologue): Ditto.
+
2003-04-05 Andrew Cagney <cagney@redhat.com>
* frame.c (legacy_get_prev_frame): Link prev to next at the
stmdb sp!, {}
sub sp, ip, #4. */
- func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET);
+ func_start = (get_frame_func (fi)) + FUNCTION_START_OFFSET);
after_prologue = SKIP_PROLOGUE (func_start);
/* There are some frameless functions whose first two instructions
{
CORE_ADDR func_start, after_prologue;
- func_start = get_pc_function_start (get_frame_pc (frame));
+ func_start = get_frame_func (frame);
if (func_start)
{
func_start += FUNCTION_START_OFFSET;
}
else
{
- ip = get_pc_function_start (get_frame_pc (fi));
+ ip = get_frame_func (fi);
sal = find_pc_line (ip, 0);
/* If there is no symbol information then sal.end == 0, and we end up
info->sp_offset = 0;
info->uses_frame = 0;
- for (pc = get_pc_function_start (frame_pc_unwind (next_frame));
+ for (pc = frame_func_unwind (next_frame);
pc < frame_pc_unwind (next_frame);
pc += 4)
{
return this_frame->pc_unwind_cache;
}
+CORE_ADDR
+frame_func_unwind (struct frame_info *fi)
+{
+ if (!fi->prev_func.p)
+ {
+ fi->prev_func.p = 1;
+ fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi));
+ }
+ return fi->prev_func.addr;
+}
+
+CORE_ADDR
+get_frame_func (struct frame_info *fi)
+{
+ return frame_func_unwind (fi->next);
+}
+
static int
do_frame_unwind_register (void *src, int regnum, void *buf)
{
this frame. */
extern CORE_ADDR get_frame_pc (struct frame_info *);
+/* Following on from the `resume' address. Return the entry point
+ address of the function containing that resume address, or zero if
+ that function isn't known. */
+extern CORE_ADDR frame_func_unwind (struct frame_info *fi);
+extern CORE_ADDR get_frame_func (struct frame_info *fi);
+
/* Closely related to the resume address, various symbol table
attributes that are determined by the PC. Note that for a normal
frame, the PC refers to the resume address after the return, and
int pc_unwind_cache_p;
CORE_ADDR pc_unwind_cache;
+ /* Cached copy of the previous frame's function address. */
+ struct
+ {
+ CORE_ADDR addr;
+ int p;
+ } prev_func;
+
/* This frame's ID. Note that the frame's ID, base and PC contain
redundant information. */
int id_p;
/* Get the starting address of the function referred to by the PC
saved in frame. */
- pc = get_pc_function_start (frame_info->pc);
+ pc = get_frame_func (frame_info);
/* Yow! */
u = find_unwind_entry (pc);
return (get_next_frame (frame)
&& get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME
&& (frameless_look_for_prologue (frame)
- || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame))));
+ || get_frame_pc (frame) == get_frame_func (frame)));
}
/* Return the chain-pointer for FRAME. In the case of the i386, the
frame_saved_regs_zalloc (fip);
- pc = get_pc_function_start (get_frame_pc (fip));
+ pc = get_frame_func (fip);
if (pc != 0)
locals = i386_get_frame_setup (pc);
{
CORE_ADDR func_start;
- func_start = get_pc_function_start (get_frame_pc (frame));
+ func_start = get_frame_func (frame);
examine_prologue (func_start, get_frame_pc (frame), frame);
}
}
}
else
{
- pc = get_pc_function_start (get_frame_pc (frame_info));
+ pc = get_frame_func (frame_info);
nextinsn = read_memory_unsigned_integer (pc, 2);
if (P_PEA_FP == nextinsn
still in the link register, otherwise walk the frames and retrieve the
saved %pc value in the previous frame. */
- addr = get_pc_function_start (get_frame_pc (frame));
+ addr = get_frame_func (frame);
(void) skip_prologue (addr, get_frame_pc (frame), &fdata);
wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
&& !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
return 0;
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
return deprecated_read_register_dummy (get_frame_pc (fi),
get_frame_base (fi), PC_REGNUM);
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
if (fdatap == NULL)
{
fdatap = &work_fdata;
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), fdatap);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap);
}
frame_saved_regs_zalloc (fi);
/* Find out if this function is using an alloca register. */
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), &fdata);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata);
/* If saved registers of this frame are not known yet, read and
cache them. */
if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised)
function_start = get_frame_extra_info (fi)->function_start;
else if (get_frame_pc (fi))
- function_start = get_pc_function_start (get_frame_pc (fi));
+ function_start = get_frame_func (fi);
return function_start;
}
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);