From ff1eb2b544c8500f48eff3418ac1e005acd5e3fe Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 3 Dec 2014 15:38:46 +0100 Subject: Use core regset iterators on Sparc Solaris Remove native-only core file handling on Sparc Solaris. Instead, enable the sparc target generic core regset logic on Solaris by providing appropriate register offset maps. Thanks to Joel Brobecker for testing! gdb/ * config/sparc/sol2.mh (NATDEPFILES): Remove core-regset.o. * sparc-sol2-tdep.c: Include "regset.h". (sparc32_sol2_supply_core_gregset): New function. (sparc32_sol2_collect_core_gregset): Likewise. (sparc32_sol2_supply_core_fpregset): Likewise. (sparc32_sol2_collect_core_fpregset): Likewise. (sparc32_sol2_gregset, sparc32_sol2_fpregset): New variables. (sparc32_sol2_init_abi): Set tdep->gregset/sizeof_gregset and tdep->fpregset/sizeof_fpregset. * sparc64-sol2-tdep.c: Include "regset.h". (sparc64_sol2_supply_core_gregset): New function. (sparc64_sol2_collect_core_gregset): Likewise. (sparc64_sol2_supply_core_fpregset): Likewise. (sparc64_sol2_collect_core_fpregset): Likewise. (sparc64_sol2_gregset, sparc64_sol2_fpregset): New variables. (sparc64_sol2_init_abi): Set tdep->gregset/sizeof_gregset and tdep->fpregset/sizeof_fpregset. --- gdb/sparc-sol2-tdep.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'gdb/sparc-sol2-tdep.c') diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c index 7a7d3eb..827bdd0 100644 --- a/gdb/sparc-sol2-tdep.c +++ b/gdb/sparc-sol2-tdep.c @@ -25,6 +25,7 @@ #include "objfiles.h" #include "osabi.h" #include "regcache.h" +#include "regset.h" #include "target.h" #include "trad-frame.h" @@ -50,6 +51,52 @@ const struct sparc_fpregmap sparc32_sol2_fpregmap = 0 * 4, /* %f0 */ 33 * 4, /* %fsr */ }; + +static void +sparc32_sol2_supply_core_gregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *gregs, size_t len) +{ + sparc32_supply_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs); +} + +static void +sparc32_sol2_collect_core_gregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *gregs, size_t len) +{ + sparc32_collect_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs); +} + +static void +sparc32_sol2_supply_core_fpregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *fpregs, size_t len) +{ + sparc32_supply_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs); +} + +static void +sparc32_sol2_collect_core_fpregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *fpregs, size_t len) +{ + sparc32_collect_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs); +} + +static const struct regset sparc32_sol2_gregset = + { + NULL, + sparc32_sol2_supply_core_gregset, + sparc32_sol2_collect_core_gregset + }; + +static const struct regset sparc32_sol2_fpregset = + { + NULL, + sparc32_sol2_supply_core_fpregset, + sparc32_sol2_collect_core_fpregset + }; /* The Solaris signal trampolines reside in libc. For normal signals, @@ -211,6 +258,12 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + tdep->gregset = &sparc32_sol2_gregset; + tdep->sizeof_gregset = 152; + + tdep->fpregset = &sparc32_sol2_fpregset; + tdep->sizeof_fpregset = 400; + /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) compiler puts out 0 instead of the address in N_SO stabs. Starting with SunPRO 3.0, the compiler does this for N_FUN stabs too. */ -- cgit v1.1