aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.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/gdbarch.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/gdbarch.c')
-rw-r--r--gdb/gdbarch.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index eeea625..648b8f5 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -243,6 +243,7 @@ struct gdbarch
gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid;
gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc;
gdbarch_unwind_pc_ftype *unwind_pc;
+ gdbarch_unwind_sp_ftype *unwind_sp;
gdbarch_frame_args_address_ftype *frame_args_address;
gdbarch_frame_locals_address_ftype *frame_locals_address;
gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call;
@@ -410,6 +411,7 @@ struct gdbarch startup_gdbarch =
0, /* deprecated_frame_chain_valid */
0, /* deprecated_frame_saved_pc */
0, /* unwind_pc */
+ 0, /* unwind_sp */
0, /* frame_args_address */
0, /* frame_locals_address */
0, /* deprecated_saved_pc_after_call */
@@ -721,6 +723,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of deprecated_frame_chain_valid, has predicate */
/* Skip verify of deprecated_frame_saved_pc, has predicate */
/* Skip verify of unwind_pc, has predicate */
+ /* Skip verify of unwind_sp, has predicate */
/* Skip verify of frame_args_address, invalid_p == 0 */
/* Skip verify of frame_locals_address, invalid_p == 0 */
/* Skip verify of deprecated_saved_pc_after_call, has predicate */
@@ -2636,6 +2639,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: unwind_pc = 0x%08lx\n",
(long) current_gdbarch->unwind_pc);
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
+ gdbarch_unwind_sp_p (current_gdbarch));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: unwind_sp = 0x%08lx\n",
+ (long) current_gdbarch->unwind_sp);
#ifdef USE_STRUCT_CONVENTION
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -4970,6 +4981,32 @@ set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
gdbarch->unwind_pc = unwind_pc;
}
+int
+gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->unwind_sp != 0;
+}
+
+CORE_ADDR
+gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->unwind_sp == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_unwind_sp invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_sp called\n");
+ return gdbarch->unwind_sp (gdbarch, next_frame);
+}
+
+void
+set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
+ gdbarch_unwind_sp_ftype unwind_sp)
+{
+ gdbarch->unwind_sp = unwind_sp;
+}
+
CORE_ADDR
gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi)
{