This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Add infrastructure for new-style core support to SPARC
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 11 Jan 2004 00:43:34 +0100 (CET)
- Subject: [PATCH] Add infrastructure for new-style core support to SPARC
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* 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.
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.137
diff -u -p -r1.137 sparc-tdep.c
--- sparc-tdep.c 5 Jan 2004 20:38:57 -0000 1.137
+++ sparc-tdep.c 10 Jan 2004 23:42:27 -0000
@@ -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_inf
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);
@@ -1073,6 +1098,11 @@ sparc32_gdbarch_init (struct gdbarch_inf
gdbarch_init_osabi (info, gdbarch);
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;
}
Index: sparc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.h,v
retrieving revision 1.4
diff -u -p -r1.4 sparc-tdep.h
--- sparc-tdep.h 3 Jan 2004 10:08:44 -0000 1.4
+++ sparc-tdep.h 10 Jan 2004 23:42:27 -0000
@@ -24,6 +24,7 @@
struct gdbarch;
struct regcache;
+struct regset;
struct trad_frame_saved_reg;
/* Register offsets for the general-purpose register set. */
@@ -50,6 +51,12 @@ struct gdbarch_tdep
definitions. */
int pc_regnum;
int npc_regnum;
+
+ /* Register sets. */
+ struct regset *gregset;
+ size_t sizeof_gregset;
+ struct regset *fpregset;
+ size_t sizeof_fpregset;
/* Offset of saved PC in jmp_buf. */
int jb_pc_offset;