This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 00/26] Regset rework
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Sep 2014 17:39:30 +0200
- Subject: [PATCH 00/26] Regset rework
- Authentication-results: sourceware.org; auth=none
Earlier this year I've posted a two-part patch series with "regset
rework preparations":
* https://sourceware.org/ml/gdb-patches/2014-05/msg00239.html
* https://sourceware.org/ml/gdb-patches/2014-07/msg00808.html
Now this patch series attempts the next major refactoring step in this
area. It has two main goals:
* Unify GDB's capabilities with respect to core files across the
various architectures. In particular enable more targets for
multi-arch capable core file generation support.
* Streamline the regset support: reduce the gdbarch interface and
reduce overall complexity.
One important means to achieve these goals is by merging two existing
gdbarch interfaces into one. Currently, the gdbarch variable
'core_regset_sections' enumerates the core file register notes to be
handled by GDB; it specifies each note section's BFD name, size, and
human-friendly name. In addition, the gdbarch method
'regset_from_core_section' translates a BFD name to a register set
definition. Both of these interfaces are merged into a single gdbarch
method 'iterate_over_regset_sections', which enumerates the core file
notes *and* provides the register set definition for each.
For illustration, a typical implementation of the gdbarch method
'regset_from_core_section' may look like this:
static const struct regset *
foo_regset_from_core_section (struct gdbarch *gdbarch,
const char *sect_name,
size_t sect_size)
{
if (strcmp (sect_name, ".reg") == 0
&& sect_size >= FOO_SIZEOF_GREGSET)
return &foo_gregset;
if (strcmp (sect_name, ".reg2") == 0
&& sect_size >= FOO_SIZEOF_FPREGSET)
return &foo_fpregset;
return NULL;
}
The new iterator would then look like this:
static void
foo_iterate_over_regset_sections (struct gdbarch *gdbarch,
iterate_over_regset_sections_cb *cb,
void *cb_data,
const struct regcache *regcache)
{
cb (".reg", FOO_SIZEOF_GREGSET, &foo_gregset, NULL, cb_data);
cb (".reg2", FOO_SIZEOF_FPREGSET, &foo_fpregset, NULL, cb_data);
}
Two kinds of targets particularly benefit from this change:
* Those which currently define the 'core_regset_sections' variable;
they now have one less gdbarch interface to deal with. In some
cases this reduces the regset handling code quite substantially.
* Those which define collect_regset functions for all register sets,
but do not define the 'core_regset_sections' variable. They gain
multi-arch capable core file generation support.
Since the regset rework preparations, all Linux targets fall into one
of these categories, except for CRIS -- which still uses the ancient
deprecated_add_core_fns.
Also, currently there is some fall-back handling for the case that
'regset_from_core_section' is defined and 'core_regset_sections' is
not. This handling is removed.
The series has been compiled with --enable-targets=all on a 64-bit
platform. It has been tested on GNU/Linux for s390x, i386, and amd64.
Any comments welcome.
Andreas Arnez (26):
Replace 'core_regset_sections' by iterator method
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
Add multi-arch capable 'fbsd_make_corefile_notes' variant
AARCH64: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
ALPHA: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
ARM: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
FRV: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
HPPA: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
X86: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
M32R: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
M68K: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
IA64: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
M88K: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
MIPS: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
MN10300: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'.
NIOS2: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
PPC: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
SCORE: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
SH: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
SPARC: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
TILEGX: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
VAX: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
XTENSA: Migrate from 'regset_from_core_section' to
'iterate_over_regset_sections'
Drop target method 'fbsd_make_corefile_notes'
Linux targets: drop fall back to target method for
'make_corefile_notes'
Drop 'regset_from_core_section' gdbarch method
gdb/Makefile.in | 4 +-
gdb/aarch64-linux-tdep.c | 26 +++----
gdb/alpha-linux-tdep.c | 24 +++---
gdb/alphabsd-tdep.h | 10 +--
gdb/alphafbsd-tdep.c | 5 ++
gdb/alphanbsd-tdep.c | 87 ++++++++++-----------
gdb/alphaobsd-tdep.c | 4 +-
gdb/amd64-linux-tdep.c | 57 +++++++++++---
gdb/amd64-tdep.c | 51 +------------
gdb/amd64-tdep.h | 2 +
gdb/amd64fbsd-nat.c | 1 -
gdb/amd64fbsd-tdep.c | 4 +
gdb/amd64obsd-tdep.c | 19 +++--
gdb/arm-linux-tdep.c | 55 ++++----------
gdb/arm-tdep.h | 8 +-
gdb/armbsd-tdep.c | 20 ++---
gdb/armobsd-tdep.c | 4 +-
gdb/configure.tgt | 8 +-
gdb/corelow.c | 86 ++++++++++++---------
gdb/fbsd-nat.c | 76 -------------------
gdb/fbsd-nat.h | 6 --
gdb/fbsd-tdep.c | 137 +++++++++++++++++++++++++++++++++
gdb/fbsd-tdep.h | 25 ++++++
gdb/frv-linux-tdep.c | 25 +++---
gdb/gdbarch.c | 54 +++++--------
gdb/gdbarch.h | 25 +++---
gdb/gdbarch.sh | 17 +++--
gdb/hppa-hpux-tdep.c | 19 +++--
gdb/hppa-linux-tdep.c | 22 +++---
gdb/hppanbsd-tdep.c | 20 +++--
gdb/hppaobsd-tdep.c | 24 +++---
gdb/i386-cygwin-tdep.c | 18 +----
gdb/i386-linux-tdep.c | 86 +++++++++++++--------
gdb/i386-tdep.c | 60 ++++-----------
gdb/i386-tdep.h | 16 ++--
gdb/i386fbsd-nat.c | 1 -
gdb/i386fbsd-tdep.c | 4 +
gdb/i386obsd-tdep.c | 20 +++--
gdb/ia64-linux-tdep.c | 24 +++---
gdb/linux-nat.c | 57 --------------
gdb/linux-tdep.c | 140 ++++++++++++++++++----------------
gdb/linux-tdep.h | 3 -
gdb/m32r-linux-tdep.c | 19 ++---
gdb/m68kbsd-tdep.c | 24 +++---
gdb/m68klinux-tdep.c | 27 +++----
gdb/m88k-tdep.c | 20 +++--
gdb/mips-linux-tdep.c | 47 +++++-------
gdb/mips64obsd-tdep.c | 20 +++--
gdb/mipsnbsd-tdep.c | 28 +++----
gdb/mn10300-linux-tdep.c | 23 +++---
gdb/nios2-linux-tdep.c | 24 +++---
gdb/ppc-linux-tdep.c | 119 ++++++-----------------------
gdb/ppcfbsd-nat.c | 1 -
gdb/ppcfbsd-tdep.c | 35 ++++-----
gdb/ppcnbsd-tdep.c | 24 +++---
gdb/ppcobsd-tdep.c | 20 +++--
gdb/procfs.c | 2 +-
gdb/regset.h | 8 --
gdb/rs6000-aix-tdep.c | 27 +++----
gdb/s390-linux-tdep.c | 192 ++++++++++-------------------------------------
gdb/score-tdep.c | 25 +++---
gdb/sh-linux-tdep.c | 4 +
gdb/sh-tdep.c | 21 +++---
gdb/sh-tdep.h | 2 +
gdb/shnbsd-tdep.c | 1 +
gdb/sparc-tdep.c | 24 +++---
gdb/sparc64fbsd-nat.c | 1 -
gdb/sparc64fbsd-tdep.c | 4 +
gdb/tilegx-linux-tdep.c | 22 +++---
gdb/vax-tdep.c | 20 +++--
gdb/xtensa-tdep.c | 27 +++----
71 files changed, 946 insertions(+), 1219 deletions(-)
create mode 100644 gdb/fbsd-tdep.c
create mode 100644 gdb/fbsd-tdep.h
--
1.8.4.2