aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-06-09 01:02:07 +0000
committerAndrew Cagney <cagney@redhat.com>2003-06-09 01:02:07 +0000
commita9e5fdc21938b3d8733bdfc5931088319c921f78 (patch)
treeb4bc9eaae69953942219023cc1089cbdd9f20a48 /gdb/regcache.c
parent5cf72d3591cee5531e4e07df09f0b063f80bd9fa (diff)
downloadgdb-a9e5fdc21938b3d8733bdfc5931088319c921f78.zip
gdb-a9e5fdc21938b3d8733bdfc5931088319c921f78.tar.gz
gdb-a9e5fdc21938b3d8733bdfc5931088319c921f78.tar.bz2
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.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 9584336..facaab3 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1351,8 +1351,11 @@ read_sp (void)
{
if (TARGET_READ_SP_P ())
return TARGET_READ_SP ();
- /* Else return SP from get_current_frame. */
+ else if (gdbarch_unwind_sp_p (current_gdbarch))
+ return get_frame_sp (get_current_frame ());
else if (SP_REGNUM >= 0)
+ /* Try SP_REGNUM last: this makes all sorts of [wrong] assumptions
+ about the architecture so put it at the end. */
return read_register (SP_REGNUM);
internal_error (__FILE__, __LINE__, "read_sp: Unable to find SP");
}