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.
This commit is contained in:
Andrew Cagney 2003-04-05 18:54:38 +00:00
parent a01dd7cc8d
commit be41e9f456
14 changed files with 72 additions and 20 deletions

View File

@ -1,3 +1,27 @@
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

View File

@ -295,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi)
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

View File

@ -146,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame)
{
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;

View File

@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
}
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

View File

@ -720,7 +720,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
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)
{

View File

@ -190,6 +190,23 @@ frame_pc_unwind (struct frame_info *this_frame)
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)
{

View File

@ -149,6 +149,12 @@ extern struct frame_info *frame_find_by_id (struct frame_id id);
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
@ -410,6 +416,13 @@ struct frame_info
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;

View File

@ -3912,7 +3912,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* 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);

View File

@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame)
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
@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip)
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);

View File

@ -1205,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame)
{
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);
}
}

View File

@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info)
}
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

View File

@ -990,7 +990,7 @@ rs6000_pop_frame (void)
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;
@ -1499,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi)
&& !(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. */
@ -1540,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi)
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. */
@ -1596,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
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);
@ -1720,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *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. */

View File

@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi)
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;
}

View File

@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi)
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);
@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
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);
@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi)
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);