From a54124c5e3df343fbffbbfc5fe2766773ff18c15 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 10 Jan 2004 23:43:25 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 11 +++++++++++ gdb/sparc-tdep.c | 30 ++++++++++++++++++++++++++++++ gdb/sparc-tdep.h | 7 +++++++ 3 files changed, 48 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 929fe9b4b03..2f026c307a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2004-01-11 Mark Kettenis + + * 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. + 2004-01-10 Mark Kettenis * x86-64-tdep.c (amd64_non_pod_p): New function. 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; } diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h index 05f2e369fa3..fc239d3547a 100644 --- a/gdb/sparc-tdep.h +++ b/gdb/sparc-tdep.h @@ -24,6 +24,7 @@ struct gdbarch; struct regcache; +struct regset; struct trad_frame_saved_reg; /* Register offsets for the general-purpose register set. */ @@ -51,6 +52,12 @@ struct gdbarch_tdep 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; -- 2.30.2