diff options
author | Andreas Arnez <arnez@linux.vnet.ibm.com> | 2014-09-12 08:42:48 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.vnet.ibm.com> | 2014-09-30 09:14:33 +0200 |
commit | 8f0435f75e3c9676d2e177ce055fed3155fd9476 (patch) | |
tree | 08032004cab3c1c432651500560db02af97b86bc /gdb/i386-linux-tdep.c | |
parent | 5aa82d050d61784823767fe3c982b6862fa47391 (diff) | |
download | gdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.zip gdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.tar.gz gdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.tar.bz2 |
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback.
Consequently the 'regset_from_core_section' method is dropped for all
targets that provide the iterator method.
This change prepares for replacing regset_from_core_section
everywhere, thereby eliminating one gdbarch interface. Since the
iterator is usually no more complex than regset_from_core_section
alone, targets that previously didn't define core_regset_sections will
then gain multi-arch capable core file generation support without
increased complexity.
gdb/ChangeLog:
* gdbarch.sh (iterate_over_regset_sections_cb): Add regset
parameter.
* gdbarch.h: Regenerate.
* corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset
iterator.
(get_core_register_section): Add parameter 'regset' and use it, if
set. Add parameter 'min_size' and verify the bfd section size
against it.
(get_core_registers_cb): Add parameter 'regset' and pass it to
get_core_register section. For the "standard" register sections
".reg" and ".reg2", set an appropriate default for human_name.
(get_core_registers): Don't abort when the gdbarch has an iterator
but no regset_from_core_section. Add NULL/0 for parameters
'regset'/'min_size' in calls to get_core_register_section.
* linux-tdep.c (linux_collect_regset_section_cb): Add parameter
'regset' and use it instead of calling the
regset_from_core_section gdbarch method.
* i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'.
* i386-tdep.c (i386_supply_xstateregset)
(i386_collect_xstateregset, i386_xstateregset): Moved to
i386-linux-tdep.c.
(i386_regset_from_core_section): Drop handling for .reg-xfp and
.reg-xstate.
(i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic
core file support only if the regset iterator hasn't been set.
* i386-linux-tdep.c (i386_linux_supply_xstateregset)
(i386_linux_collect_xstateregset, i386_linux_xstateregset): New.
Moved from i386-tdep.c and renamed to *_linux*.
(i386_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation. Allow any .reg-xstate size when reading
from a core file.
* amd64-tdep.c (amd64_supply_xstateregset)
(amd64_collect_xstateregset, amd64_xstateregset): Moved to
amd64-linux-tdep.c.
(amd64_regset_from_core_section): Remove.
(amd64_init_abi): Set new tdep field 'fpregset'. No longer
install an amd64-specific regset_from_core_section gdbarch method.
* amd64-linux-tdep.c (amd64_linux_supply_xstateregset)
(amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New.
Moved from amd64-tdep.c and renamed to *_linux*.
(amd64_linux_iterate_over_regset_sections): Add regset parameter
to each callback invocation. Allow any .reg-xstate size when
reading from a core file.
* arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove.
(arm_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(arm_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove.
(ppc_linux_iterate_over_regset_sections): Add regset parameter to
each callback invocation.
(ppc_linux_init_abi): No longer set the regset_from_core_section
gdbarch method.
* s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields
gregset, sizeof_gregset, fpregset, and sizeof_fpregset.
(s390_regset_from_core_section): Remove.
(s390_iterate_over_regset_sections): Add regset parameter to each
callback invocation.
(s390_gdbarch_init): No longer set the regset_from_core_section
gdbarch method. Drop initialization of deleted tdep fields.
Diffstat (limited to 'gdb/i386-linux-tdep.c')
-rw-r--r-- | gdb/i386-linux-tdep.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 4ee6874..7feb21d 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -648,6 +648,35 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, return tdesc_i386_mmx_linux; } +/* Similar to i386_supply_fpregset, but use XSAVE extended state. */ + +static void +i386_linux_supply_xstateregset (const struct regset *regset, + struct regcache *regcache, int regnum, + const void *xstateregs, size_t len) +{ + i387_supply_xsave (regcache, regnum, xstateregs); +} + +/* Similar to i386_collect_fpregset, but use XSAVE extended state. */ + +static void +i386_linux_collect_xstateregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *xstateregs, size_t len) +{ + i387_collect_xsave (regcache, regnum, xstateregs, 1); +} + +/* Register set definitions. */ + +static const struct regset i386_linux_xstateregset = + { + NULL, + i386_linux_supply_xstateregset, + i386_linux_collect_xstateregset + }; + /* Iterate over core file register note sections. */ static void @@ -658,14 +687,17 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - cb (".reg", 68, "general-purpose", cb_data); + cb (".reg", 68, &i386_gregset, NULL, cb_data); if (tdep->xcr0 & X86_XSTATE_AVX) - cb (".reg-xstate", X86_XSTATE_MAX_SIZE, "XSAVE extended state", cb_data); + /* Use max size for writing, accept any size when reading. */ + cb (".reg-xstate", regcache ? X86_XSTATE_MAX_SIZE : 0, + &i386_linux_xstateregset, "XSAVE extended state", cb_data); else if (tdep->xcr0 & X86_XSTATE_SSE) - cb (".reg-xfp", 512, "extended floating-point", cb_data); + cb (".reg-xfp", 512, &i386_fpregset, "extended floating-point", + cb_data); else - cb (".reg2", 108, "floating-point", cb_data); + cb (".reg2", 108, &i386_fpregset, NULL, cb_data); } /* Linux kernel shows PC value after the 'int $0x80' instruction even if |