forked from Imagelibrary/binutils-gdb
2003-06-08 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (UNWIND_SP): Add. * gdbarch.h, gdbarch.c: Re-generate. * frame.c (frame_sp_unwind): New function. (get_frame_sp): New function. * frame.h (get_frame_sp, frame_sp_unwind): Declare. * regcache.c (read_sp): Rewrite, try each of TARGET_READ_SP, gdbarch_unwind_sp and SP_REGNUM when looking for the SP register value. * d10v-tdep.c (d10v_unwind_sp): Replace d10v_read_sp. (d10v_gdbarch_init): Set unwind_sp instead of read_sp. 2003-06-08 Andrew Cagney <cagney@redhat.com> * gdbint.texinfo (Target Architecture Definition): Document "unwind_sp". Cross reference "unwind_sp" and TARGET_READ_SP.
This commit is contained in:
31
gdb/frame.c
31
gdb/frame.c
@@ -2250,6 +2250,37 @@ get_frame_arch (struct frame_info *this_frame)
|
||||
return current_gdbarch;
|
||||
}
|
||||
|
||||
/* Stack pointer methods. */
|
||||
|
||||
CORE_ADDR
|
||||
get_frame_sp (struct frame_info *this_frame)
|
||||
{
|
||||
return frame_sp_unwind (this_frame->next);
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
frame_sp_unwind (struct frame_info *next_frame)
|
||||
{
|
||||
/* Normality, an architecture that provides a way of obtaining any
|
||||
frame inner-most address. */
|
||||
if (gdbarch_unwind_sp_p (current_gdbarch))
|
||||
return gdbarch_unwind_sp (current_gdbarch, next_frame);
|
||||
/* Things are looking grim. If it's the inner-most frame and there
|
||||
is a TARGET_READ_SP then that can be used. */
|
||||
if (next_frame->level < 0 && TARGET_READ_SP_P ())
|
||||
return TARGET_READ_SP ();
|
||||
/* Now things are really are grim. Hope that the value returned by
|
||||
the SP_REGNUM register is meaningful. */
|
||||
if (SP_REGNUM >= 0)
|
||||
{
|
||||
ULONGEST sp;
|
||||
frame_unwind_unsigned_register (next_frame, SP_REGNUM, &sp);
|
||||
return sp;
|
||||
}
|
||||
internal_error (__FILE__, __LINE__, "Missing unwind SP method");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
legacy_frame_p (struct gdbarch *current_gdbarch)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user