aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-01-10 23:43:25 +0000
committerMark Kettenis <kettenis@gnu.org>2004-01-10 23:43:25 +0000
commita54124c5e3df343fbffbbfc5fe2766773ff18c15 (patch)
treec8b19fa973097b228826b2375315fc4bdc063b38 /gdb/sparc-tdep.c
parentdaily update (diff)
downloadbinutils-gdb-a54124c5e3df343fbffbbfc5fe2766773ff18c15.tar.gz
binutils-gdb-a54124c5e3df343fbffbbfc5fe2766773ff18c15.tar.bz2
binutils-gdb-a54124c5e3df343fbffbbfc5fe2766773ff18c15.zip
* sparc-tdep.h (struct regset): Provide opaque declaration.
(struct gdbarch_tdep): Add gregset, sizeof_gregset, fpregset and sizeof_fpregset members. * sparc-tdep.c (struct regset): Provide opaque declaration. (sparc_regset_from_core_section): New function. (sparc32_gdbarch_init): Initialize TDEP->gregset, TDEP->sizeof_gregset, TDEP->fpregset and TDEP->sizeof_fpregset. Set regset_from_core_section when appropriate.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r--gdb/sparc-tdep.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 92684a325b5..26d2c2431bb 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -41,6 +41,8 @@
#include "sparc-tdep.h"
+struct regset;
+
/* This file implements the The SPARC 32-bit ABI as defined by the
section "Low-Level System Information" of the SPARC Compliance
Definition (SCD) 2.4.1, which is the 32-bit System V psABI for
@@ -1004,6 +1006,25 @@ sparc_stabs_unglobalize_name (char *name)
}
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+
+const struct regset *
+sparc_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name, size_t sect_size)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
+ return tdep->gregset;
+
+ if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
+ return tdep->fpregset;
+
+ return NULL;
+}
+
+
static struct gdbarch *
sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -1021,6 +1042,10 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->pc_regnum = SPARC32_PC_REGNUM;
tdep->npc_regnum = SPARC32_NPC_REGNUM;
+ tdep->gregset = NULL;
+ tdep->sizeof_gregset = 20 * 4;
+ tdep->fpregset = NULL;
+ tdep->sizeof_fpregset = 33 * 4;
tdep->plt_entry_size = 0;
set_gdbarch_long_double_bit (gdbarch, 128);
@@ -1074,6 +1099,11 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_sniffer (gdbarch, sparc32_frame_sniffer);
+ /* If we have register sets, enable the generic core file support. */
+ if (tdep->gregset && tdep->fpregset)
+ set_gdbarch_regset_from_core_section (gdbarch,
+ sparc_regset_from_core_section);
+
return gdbarch;
}