public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC 00/23] Regset rework preparations
@ 2014-04-28  9:35 Andreas Arnez
  2014-04-28  9:39 ` [RFC 01/23] Constify regset structures Andreas Arnez
                   ` (24 more replies)
  0 siblings, 25 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand

This patch series intends to make regset definitions more similar across
architectures.  It is the first half of a "regset rework" series which
(in particular) makes core file handling multi-arch capable for all
Linux platforms.  Since the whole series seemed too bulky at one go, I
decided to split it and collect some feedback for the first half before
going on.

Outline:

* Patch 1 ("Constify regset structures"): Converts (unnecessarily)
  non-constant static regsets to constant ones.

* Patch 2 ("Remove 'arch' field from regset structure"): Removes the
  only inherently dynamic field from the regset structure.

* Patch 3-8 and 10 ("Replace regset_alloc() invocations by static
  regset structures."): Eliminate dynamic regset allocations and
  replace them by static constant structures, now that regsets don't
  carry dynamic data any more.  This generally simplifies the code and
  increases the similarity of regset definitions across architectures.

* Patch 9 ("SPARC: Rename register maps from "*regset" to "*regmap"):
  Adjusts naming, to avoid name clashes in patch 10.

* Patch 11 ("Drop regset_alloc()"): Removes the now-unused function.

* Patch 12 ("regcache: Add functions suitable for
  regset_supply/collect"): Provides generic supply/collect functions,
  such that architecture-specific logic can be reduced.

* Patch 13 ("S390: Migrate to regcache_supply/collect_regset"):
  Exploits the new generic supply/collect functions from patch 12 for
  S390.  Such exploitation is likely possible by other architectures
  as well; this patch provides an example.

* Patch 14-21 ("Fill 'collect_regset' in regset structures"): Add the
  collect_regset method to all Linux regsets where it had been
  missing.  This is necessary, but not sufficient, to make the "gcore"
  command multi-arch capable.  Some of these patches exploit the new
  generic supply/collect functions from patch 12.  No real new
  functionality is provided, but an important prerequisite for
  multi-arch capable core file handling is fulfilled.

* Patch 22, 23 ("Define regset structures"): Define regset structures
  for each of the Linux targets that lacked them before (M68K and
  IA64).  Exploit the new generic supply/collect functions from patch
  12.  These patches should make core file reading (but not writing)
  multi-arch capable for these targets.

Note that all architecture-specific changes except for S390 are
completely untested.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 01/23] Constify regset structures.
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
@ 2014-04-28  9:39 ` Andreas Arnez
  2014-05-05  9:45   ` Mark Kettenis
  2014-04-28  9:40 ` [RFC 02/23] Remove 'arch' field from regset structure Andreas Arnez
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:39 UTC (permalink / raw)
  To: gdb-patches
  Cc: Kevin Buettner, Yao Qi, Richard Earnshaw, Jiong Wang,
	Maciej W. Rozycki, Randolph Chung, Kei Sakamoto, Andreas Schwab,
	Mark Kettenis, Richard Henderson

Convert (unnecessarily) non-constant static regsets to constant ones.

gdb/
	* alpha-linux-tdep.c (alpha_linux_gregset, alpha_linux_fpregset):
	Constify structures.
	* alphanbsd-tdep.c (alphanbsd_gregset, alphanbsd_fpregset)
	(alphanbsd_aout_gregset): Likewise.
	* armbsd-tdep.c (armbsd_gregset, armbsd_fpregset): Likewise.
	* frv-linux-tdep.c (frv_linux_gregset, frv_linux_fpregset):
	Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_regset): Likewise.
	* hppa-linux-tdep.c (hppa_linux_regset, hppa_linux_fpregset):
	Likewise.
	* hppanbsd-tdep.c (hppanbsd_gregset): Likewise.
	* hppaobsd-tdep.c (hppaobsd_gregset, hppaobsd_fpregset): Likewise.
	* m32r-linux-tdep.c (m32r_linux_gregset): Likewise.
	* m68kbsd-tdep.c (m68kbsd_gregset, m68kbsd_fpregset): Likewise.
	* m88k-tdep.c (m88k_gregset): Likewise.
	* mips64obsd-tdep.c (mips64obsd_gregset): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_gregset, mipsnbsd_fpregset): Likewise.
	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
	* ppcfbsd-tdep.c (ppc32_fbsd_fpregset): Likewise.
	* ppcnbsd-tdep.c (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
	* ppcnbsd-tdep.h (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
	* ppcobsd-tdep.c (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
	* ppcobsd-tdep.h (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
	* rs6000-aix-tdep.c (rs6000_aix32_regset, rs6000_aix64_regset):
	Likewise.
	* sh-tdep.c (sh_corefile_gregset, sh_corefile_fpregset): Likewise.
	* sh-tdep.h (sh_corefile_gregset): Likewise.
	* tilegx-linux-tdep.c (tilegx_linux_regset): Likewise.
	* vax-tdep.c (vax_gregset): Likewise.
---
 gdb/alpha-linux-tdep.c  | 4 ++--
 gdb/alphanbsd-tdep.c    | 6 +++---
 gdb/armbsd-tdep.c       | 4 ++--
 gdb/frv-linux-tdep.c    | 4 ++--
 gdb/hppa-hpux-tdep.c    | 2 +-
 gdb/hppa-linux-tdep.c   | 4 ++--
 gdb/hppanbsd-tdep.c     | 2 +-
 gdb/hppaobsd-tdep.c     | 4 ++--
 gdb/m32r-linux-tdep.c   | 2 +-
 gdb/m68kbsd-tdep.c      | 4 ++--
 gdb/m88k-tdep.c         | 2 +-
 gdb/mips64obsd-tdep.c   | 2 +-
 gdb/mipsnbsd-tdep.c     | 4 ++--
 gdb/nios2-linux-tdep.c  | 2 +-
 gdb/ppcfbsd-tdep.c      | 2 +-
 gdb/ppcnbsd-tdep.c      | 4 ++--
 gdb/ppcnbsd-tdep.h      | 4 ++--
 gdb/ppcobsd-tdep.c      | 4 ++--
 gdb/ppcobsd-tdep.h      | 4 ++--
 gdb/rs6000-aix-tdep.c   | 4 ++--
 gdb/sh-tdep.c           | 4 ++--
 gdb/sh-tdep.h           | 2 +-
 gdb/tilegx-linux-tdep.c | 2 +-
 gdb/vax-tdep.c          | 2 +-
 24 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 0f39968..52f19d0 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -206,13 +206,13 @@ alpha_linux_supply_fpregset (const struct regset *regset,
     regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8);
 }
 
-static struct regset alpha_linux_gregset =
+static const struct regset alpha_linux_gregset =
 {
   NULL,
   alpha_linux_supply_gregset
 };
 
-static struct regset alpha_linux_fpregset =
+static const struct regset alpha_linux_fpregset =
 {
   NULL,
   alpha_linux_supply_fpregset
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index 2225790..58d9f32 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -141,19 +141,19 @@ alphanbsd_aout_supply_gregset (const struct regset *regset,
 
 /* NetBSD/alpha register sets.  */
 
-static struct regset alphanbsd_gregset =
+static const struct regset alphanbsd_gregset =
 {
   NULL,
   alphanbsd_supply_gregset
 };
 
-static struct regset alphanbsd_fpregset =
+static const struct regset alphanbsd_fpregset =
 {
   NULL,
   alphanbsd_supply_fpregset
 };
 
-static struct regset alphanbsd_aout_gregset =
+static const struct regset alphanbsd_aout_gregset =
 {
   NULL,
   alphanbsd_aout_supply_gregset
diff --git a/gdb/armbsd-tdep.c b/gdb/armbsd-tdep.c
index b57af3d..036db6c 100644
--- a/gdb/armbsd-tdep.c
+++ b/gdb/armbsd-tdep.c
@@ -98,13 +98,13 @@ armbsd_supply_gregset (const struct regset *regset,
 
 /* ARM register sets.  */
 
-static struct regset armbsd_gregset =
+static const struct regset armbsd_gregset =
 {
   NULL,
   armbsd_supply_gregset
 };
 
-static struct regset armbsd_fpregset =
+static const struct regset armbsd_fpregset =
 {
   NULL,
   armbsd_supply_fpregset
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 2ddc3f2..fb163a8 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -465,13 +465,13 @@ frv_linux_supply_fpregset (const struct regset *regset,
 
 /* FRV Linux kernel register sets.  */
 
-static struct regset frv_linux_gregset =
+static const struct regset frv_linux_gregset =
 {
   NULL,
   frv_linux_supply_gregset
 };
 
-static struct regset frv_linux_fpregset =
+static const struct regset frv_linux_fpregset =
 {
   NULL,
   frv_linux_supply_fpregset
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 8d4686f..588f577 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -1367,7 +1367,7 @@ hppa_hpux_supply_save_state (const struct regset *regset,
 
 /* HP-UX register set.  */
 
-static struct regset hppa_hpux_regset =
+static const struct regset hppa_hpux_regset =
 {
   NULL,
   hppa_hpux_supply_save_state
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 4e89048..7a765a2 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -491,13 +491,13 @@ hppa_linux_supply_fpregset (const struct regset *regset,
 }
 
 /* HPPA Linux kernel register set.  */
-static struct regset hppa_linux_regset =
+static const struct regset hppa_linux_regset =
 {
   NULL,
   hppa_linux_supply_regset
 };
 
-static struct regset hppa_linux_fpregset =
+static const struct regset hppa_linux_fpregset =
 {
   NULL,
   hppa_linux_supply_fpregset
diff --git a/gdb/hppanbsd-tdep.c b/gdb/hppanbsd-tdep.c
index 466aa69..fdc9719 100644
--- a/gdb/hppanbsd-tdep.c
+++ b/gdb/hppanbsd-tdep.c
@@ -181,7 +181,7 @@ hppanbsd_supply_gregset (const struct regset *regset,
 
 /* NetBSD/hppa register set.  */
 
-static struct regset hppanbsd_gregset =
+static const struct regset hppanbsd_gregset =
 {
   NULL,
   hppanbsd_supply_gregset
diff --git a/gdb/hppaobsd-tdep.c b/gdb/hppaobsd-tdep.c
index 7f517dc..8dc03a2 100644
--- a/gdb/hppaobsd-tdep.c
+++ b/gdb/hppaobsd-tdep.c
@@ -131,13 +131,13 @@ hppaobsd_supply_fpregset (const struct regset *regset,
 
 /* OpenBSD/hppa register sets.  */
 
-static struct regset hppaobsd_gregset =
+static const struct regset hppaobsd_gregset =
 {
   NULL,
   hppaobsd_supply_gregset
 };
 
-static struct regset hppaobsd_fpregset =
+static const struct regset hppaobsd_fpregset =
 {
   NULL,
   hppaobsd_supply_fpregset
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index 683b67e..bf1ffff 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -388,7 +388,7 @@ m32r_linux_supply_gregset (const struct regset *regset,
     }
 }
 
-static struct regset m32r_linux_gregset = {
+static const struct regset m32r_linux_gregset = {
   NULL, m32r_linux_supply_gregset
 };
 
diff --git a/gdb/m68kbsd-tdep.c b/gdb/m68kbsd-tdep.c
index e59bc66..d27beb8 100644
--- a/gdb/m68kbsd-tdep.c
+++ b/gdb/m68kbsd-tdep.c
@@ -105,13 +105,13 @@ m68kbsd_supply_gregset (const struct regset *regset,
 
 /* Motorola 68000 register sets.  */
 
-static struct regset m68kbsd_gregset =
+static const struct regset m68kbsd_gregset =
 {
   NULL,
   m68kbsd_supply_gregset
 };
 
-static struct regset m68kbsd_fpregset =
+static const struct regset m68kbsd_fpregset =
 {
   NULL,
   m68kbsd_supply_fpregset
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index bab7fee..56384a7 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -799,7 +799,7 @@ m88k_supply_gregset (const struct regset *regset,
 
 /* Motorola 88000 register set.  */
 
-static struct regset m88k_gregset =
+static const struct regset m88k_gregset =
 {
   NULL,
   m88k_supply_gregset
diff --git a/gdb/mips64obsd-tdep.c b/gdb/mips64obsd-tdep.c
index 62853ce..6d8b9ee 100644
--- a/gdb/mips64obsd-tdep.c
+++ b/gdb/mips64obsd-tdep.c
@@ -61,7 +61,7 @@ mips64obsd_supply_gregset (const struct regset *regset,
 
 /* OpenBSD/mips64 register set.  */
 
-static struct regset mips64obsd_gregset =
+static const struct regset mips64obsd_gregset =
 {
   NULL,
   mips64obsd_supply_gregset
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index 9742150..31b8dca 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -103,13 +103,13 @@ mipsnbsd_supply_gregset (const struct regset *regset,
 
 /* NetBSD/mips register sets.  */
 
-static struct regset mipsnbsd_gregset =
+static const struct regset mipsnbsd_gregset =
 {
   NULL,
   mipsnbsd_supply_gregset
 };
 
-static struct regset mipsnbsd_fpregset =
+static const struct regset mipsnbsd_fpregset =
 {
   NULL,
   mipsnbsd_supply_fpregset
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index 792a4da..d9a51a8 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -73,7 +73,7 @@ nios2_supply_gregset (const struct regset *regset,
       }
 }
 
-static struct regset nios2_core_regset =
+static const struct regset nios2_core_regset =
 {
   NULL,
   nios2_supply_gregset,
diff --git a/gdb/ppcfbsd-tdep.c b/gdb/ppcfbsd-tdep.c
index a03c6a9..77292f3 100644
--- a/gdb/ppcfbsd-tdep.c
+++ b/gdb/ppcfbsd-tdep.c
@@ -115,7 +115,7 @@ static const struct regset ppc64_fbsd_gregset = {
 
 /* 32-/64-bit floating-point register set.  */
 
-static struct regset ppc32_fbsd_fpregset = {
+static const struct regset ppc32_fbsd_fpregset = {
   &ppc32_fbsd_reg_offsets,
   ppc_supply_fpregset,
   ppc_collect_fpregset
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 58e6599..6fe8477 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -42,13 +42,13 @@ struct ppc_reg_offsets ppcnbsd_reg_offsets;
 
 /* NetBSD/powerpc register sets.  */
 
-struct regset ppcnbsd_gregset =
+const struct regset ppcnbsd_gregset =
 {
   &ppcnbsd_reg_offsets,
   ppc_supply_gregset
 };
 
-struct regset ppcnbsd_fpregset =
+const struct regset ppcnbsd_fpregset =
 {
   &ppcnbsd_reg_offsets,
   ppc_supply_fpregset
diff --git a/gdb/ppcnbsd-tdep.h b/gdb/ppcnbsd-tdep.h
index 52f6478..747b452 100644
--- a/gdb/ppcnbsd-tdep.h
+++ b/gdb/ppcnbsd-tdep.h
@@ -28,7 +28,7 @@ struct regset;
 extern struct ppc_reg_offsets ppcnbsd_reg_offsets;
 
 /* Register sets for NetBSD/powerpc.  */
-extern struct regset ppcnbsd_gregset;
-extern struct regset ppcnbsd_fpregset;
+extern const struct regset ppcnbsd_gregset;
+extern const struct regset ppcnbsd_fpregset;
 
 #endif /* ppcnbsd-tdep.h */
diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c
index ac60bcc..2cdf687 100644
--- a/gdb/ppcobsd-tdep.c
+++ b/gdb/ppcobsd-tdep.c
@@ -71,13 +71,13 @@ ppcobsd_collect_gregset (const struct regset *regset,
 
 /* OpenBSD/powerpc register set.  */
 
-struct regset ppcobsd_gregset =
+const struct regset ppcobsd_gregset =
 {
   &ppcobsd_reg_offsets,
   ppcobsd_supply_gregset
 };
 
-struct regset ppcobsd_fpregset =
+const struct regset ppcobsd_fpregset =
 {
   &ppcobsd_fpreg_offsets,
   ppc_supply_fpregset
diff --git a/gdb/ppcobsd-tdep.h b/gdb/ppcobsd-tdep.h
index ea6bd3d..8c9ac3a 100644
--- a/gdb/ppcobsd-tdep.h
+++ b/gdb/ppcobsd-tdep.h
@@ -30,8 +30,8 @@ extern struct ppc_reg_offsets ppcobsd_reg_offsets;
 extern struct ppc_reg_offsets ppcobsd_fpreg_offsets;
 
 /* Register sets for OpenBSD/powerpc.  */
-extern struct regset ppcobsd_gregset;
-extern struct regset ppcobsd_fpregset;
+extern const struct regset ppcobsd_gregset;
+extern const struct regset ppcobsd_fpregset;
 \f
 
 /* Supply register REGNUM in the general-purpose register set REGSET
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 3ab8883..83e881e 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -135,14 +135,14 @@ rs6000_aix_collect_regset (const struct regset *regset,
 
 /* AIX register set.  */
 
-static struct regset rs6000_aix32_regset =
+static const struct regset rs6000_aix32_regset =
 {
   &rs6000_aix32_reg_offsets,
   rs6000_aix_supply_regset,
   rs6000_aix_collect_regset,
 };
 
-static struct regset rs6000_aix64_regset =
+static const struct regset rs6000_aix64_regset =
 {
   &rs6000_aix64_reg_offsets,
   rs6000_aix_supply_regset,
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 85f8067..0c1fbed 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2195,14 +2195,14 @@ sh_corefile_collect_regset (const struct regset *regset,
 /* The following two regsets have the same contents, so it is tempting to
    unify them, but they are distiguished by their address, so don't.  */
 
-struct regset sh_corefile_gregset =
+const struct regset sh_corefile_gregset =
 {
   NULL,
   sh_corefile_supply_regset,
   sh_corefile_collect_regset
 };
 
-static struct regset sh_corefile_fpregset =
+static const struct regset sh_corefile_fpregset =
 {
   NULL,
   sh_corefile_supply_regset,
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index 3e3c746..5d64c74 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -101,7 +101,7 @@ struct gdbarch_tdep
   struct sh_corefile_regmap *core_fpregmap;
 };
 
-extern struct regset sh_corefile_gregset;
+extern const struct regset sh_corefile_gregset;
 
 void sh_corefile_supply_regset (const struct regset *regset,
 				struct regcache *regcache,
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index 98b071a..98b03db 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -97,7 +97,7 @@ tilegx_linux_supply_regset (const struct regset *regset,
 }
 
 /* TILE-Gx Linux kernel register set.  */
-static struct regset tilegx_linux_regset =
+static const struct regset tilegx_linux_regset =
 {
   NULL,
   tilegx_linux_supply_regset
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index efa702c..4780c90 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -85,7 +85,7 @@ vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
 
 /* VAX register set.  */
 
-static struct regset vax_gregset =
+static const struct regset vax_gregset =
 {
   NULL,
   vax_supply_gregset
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 02/23] Remove 'arch' field from regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
  2014-04-28  9:39 ` [RFC 01/23] Constify regset structures Andreas Arnez
@ 2014-04-28  9:40 ` Andreas Arnez
  2014-05-05  9:32   ` Mark Kettenis
  2014-04-28  9:44 ` [RFC 03/23] AARCH64: Replace regset_alloc() invocations by static regset structures Andreas Arnez
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kevin Buettner, Yao Qi, Mark Kettenis

Removes the 'arch' field from the regset structure, since it
represents the only "dynamic" data in a regset.  It was referenced in
some regset supply- and collect routines, to get access to the gdbarch
associated with the regset.  Naturally, the affected routines always
have access to the regcache to be supplied to or collected from.  Thus
the gdbarch associated with that regcache can be used instead.

gdb/
	* regset.h (struct regset): Remove gdbarch field.
	* regset.c (regset_alloc): Drop initialization of gdbarch field.
	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
	* ppcfbsd-tdep.c (ppc32_fbsd_gregset, ppc64_fbsd_gregset):
	Likewise.
	* ppc-linux-tdep.c (ppc32_linux_gregset, ppc64_linux_gregset)
	(ppc32_linux_fpregset, ppc32_linux_vrregset)
	(ppc32_linux_vsxregset): Likewise.
	* i386obsd-tdep.c (i386obsd_aout_supply_regset): Get the gdbarch
	via the regcache instead of the regset.
	* i386-tdep.c (i386_supply_gregset, i386_collect_gregset)
	(i386_supply_fpregset, i386_collect_fpregset): Likewise.
	* amd64obsd-tdep.c (amd64obsd_supply_regset): Likewise.
	* amd64-tdep.c (amd64_supply_fpregset, amd64_collect_fpregset):
	Likewise.
---
 gdb/amd64-tdep.c       |  4 ++--
 gdb/amd64obsd-tdep.c   |  2 +-
 gdb/i386-tdep.c        |  8 ++++----
 gdb/i386obsd-tdep.c    |  2 +-
 gdb/nios2-linux-tdep.c |  1 -
 gdb/ppc-linux-tdep.c   | 15 +++++----------
 gdb/ppcfbsd-tdep.c     |  6 ++----
 gdb/regset.c           |  1 -
 gdb/regset.h           |  3 ---
 9 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 035b460..df4a3f4 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2842,7 +2842,7 @@ static void
 amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		       int regnum, const void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
 
   gdb_assert (len == tdep->sizeof_fpregset);
   amd64_supply_fxsave (regcache, regnum, fpregs);
@@ -2858,7 +2858,7 @@ amd64_collect_fpregset (const struct regset *regset,
 			const struct regcache *regcache,
 			int regnum, void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
 
   gdb_assert (len == tdep->sizeof_fpregset);
   amd64_collect_fxsave (regcache, regnum, fpregs);
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index 9446318..c5ed731 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -45,7 +45,7 @@ amd64obsd_supply_regset (const struct regset *regset,
 			 struct regcache *regcache, int regnum,
 			 const void *regs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index ecbf730..de783f6 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3724,7 +3724,7 @@ void
 i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *gregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
   const gdb_byte *regs = gregs;
   int i;
 
@@ -3748,7 +3748,7 @@ i386_collect_gregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *gregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
   gdb_byte *regs = gregs;
   int i;
 
@@ -3770,7 +3770,7 @@ static void
 i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		      int regnum, const void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
 
   if (len == I387_SIZEOF_FXSAVE)
     {
@@ -3792,7 +3792,7 @@ i386_collect_fpregset (const struct regset *regset,
 		       const struct regcache *regcache,
 		       int regnum, void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
 
   if (len == I387_SIZEOF_FXSAVE)
     {
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index cf19c50..bc29606 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -142,7 +142,7 @@ i386obsd_aout_supply_regset (const struct regset *regset,
 			     struct regcache *regcache, int regnum,
 			     const void *regs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
   const gdb_byte *gregs = regs;
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index d9a51a8..84ab576 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -78,7 +78,6 @@ static const struct regset nios2_core_regset =
   NULL,
   nios2_supply_gregset,
   NULL,
-  NULL
 };
 
 /* Implement the regset_from_core_section gdbarch method.  */
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 5278a24..5410554 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -498,36 +498,31 @@ static const struct ppc_reg_offsets ppc64_linux_reg_offsets =
 static const struct regset ppc32_linux_gregset = {
   &ppc32_linux_reg_offsets,
   ppc_linux_supply_gregset,
-  ppc_linux_collect_gregset,
-  NULL
+  ppc_linux_collect_gregset
 };
 
 static const struct regset ppc64_linux_gregset = {
   &ppc64_linux_reg_offsets,
   ppc_linux_supply_gregset,
-  ppc_linux_collect_gregset,
-  NULL
+  ppc_linux_collect_gregset
 };
 
 static const struct regset ppc32_linux_fpregset = {
   &ppc32_linux_reg_offsets,
   ppc_supply_fpregset,
-  ppc_collect_fpregset,
-  NULL
+  ppc_collect_fpregset
 };
 
 static const struct regset ppc32_linux_vrregset = {
   &ppc32_linux_reg_offsets,
   ppc_supply_vrregset,
-  ppc_collect_vrregset,
-  NULL
+  ppc_collect_vrregset
 };
 
 static const struct regset ppc32_linux_vsxregset = {
   &ppc32_linux_reg_offsets,
   ppc_supply_vsxregset,
-  ppc_collect_vsxregset,
-  NULL
+  ppc_collect_vsxregset
 };
 
 const struct regset *
diff --git a/gdb/ppcfbsd-tdep.c b/gdb/ppcfbsd-tdep.c
index 77292f3..28f5b7b 100644
--- a/gdb/ppcfbsd-tdep.c
+++ b/gdb/ppcfbsd-tdep.c
@@ -100,8 +100,7 @@ static const struct ppc_reg_offsets ppc64_fbsd_reg_offsets =
 static const struct regset ppc32_fbsd_gregset = {
   &ppc32_fbsd_reg_offsets,
   ppc_supply_gregset,
-  ppc_collect_gregset,
-  NULL
+  ppc_collect_gregset
 };
 
 /* 64-bit general-purpose register set.  */
@@ -109,8 +108,7 @@ static const struct regset ppc32_fbsd_gregset = {
 static const struct regset ppc64_fbsd_gregset = {
   &ppc64_fbsd_reg_offsets,
   ppc_supply_gregset,
-  ppc_collect_gregset,
-  NULL
+  ppc_collect_gregset
 };
 
 /* 32-/64-bit floating-point register set.  */
diff --git a/gdb/regset.c b/gdb/regset.c
index a56641f..1d19d34 100644
--- a/gdb/regset.c
+++ b/gdb/regset.c
@@ -36,7 +36,6 @@ regset_alloc (struct gdbarch *arch,
 {
   struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
 
-  regset->arch = arch;
   regset->supply_regset = supply_regset;
   regset->collect_regset = collect_regset;
 
diff --git a/gdb/regset.h b/gdb/regset.h
index fe804cc..f1a6e24 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -50,9 +50,6 @@ struct regset
 
   /* Function collecting values in a register set from a register cache.  */
   collect_regset_ftype *collect_regset;
-
-  /* Architecture associated with the register set.  */
-  struct gdbarch *arch;
 };
 
 /* Allocate a fresh 'struct regset' whose supply_regset function is
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 03/23] AARCH64: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
  2014-04-28  9:39 ` [RFC 01/23] Constify regset structures Andreas Arnez
  2014-04-28  9:40 ` [RFC 02/23] Remove 'arch' field from regset structure Andreas Arnez
@ 2014-04-28  9:44 ` Andreas Arnez
  2014-04-28  9:46 ` [RFC 04/23] ARM: " Andreas Arnez
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Earnshaw

After removal of the regset_alloc invocations, the tdep fields
'gregset' and 'fpregset' become obsolete and are thus removed.

gdb/
	* aarch64-linux-tdep.c (aarch64_linux_gregset)
	(aarch64_linux_fpregset): New static regset structures.
	(aarch64_linux_regset_from_core_section): Drop dynamic allocation
	of regset structures.
	* aarch64-tdep.h (struct gdbarch_tdep): Remove 'gregset' and
	'fpregset' fields.
---
 gdb/aarch64-linux-tdep.c | 29 +++++++++++++++--------------
 gdb/aarch64-tdep.h       |  4 ----
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 92d1248..6f52c8c 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -240,6 +240,18 @@ supply_fpregset_from_core (const struct regset *regset,
   aarch64_linux_supply_fpregset (regcache, (const gdb_byte *) regbuf);
 }
 
+/* Register set definitions. */
+
+static const struct regset aarch64_linux_gregset =
+  {
+    NULL, supply_gregset_from_core, NULL
+  };
+
+static const struct regset aarch64_linux_fpregset =
+  {
+    NULL, supply_fpregset_from_core, NULL
+  };
+
 /* Implement the "regset_from_core_section" gdbarch method.  */
 
 static const struct regset *
@@ -247,25 +259,14 @@ aarch64_linux_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 == AARCH64_LINUX_SIZEOF_GREGSET)
-    {
-      if (tdep->gregset == NULL)
-	tdep->gregset = regset_alloc (gdbarch, supply_gregset_from_core,
-				      NULL);
-      return tdep->gregset;
-    }
+    return &aarch64_linux_gregset;
 
   if (strcmp (sect_name, ".reg2") == 0
       && sect_size == AARCH64_LINUX_SIZEOF_FPREGSET)
-    {
-      if (tdep->fpregset == NULL)
-	tdep->fpregset = regset_alloc (gdbarch, supply_fpregset_from_core,
-				       NULL);
-      return tdep->fpregset;
-    }
+    return &aarch64_linux_fpregset;
+
   return NULL;
 }
 
diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index 30a5ee3..78fb779 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -82,10 +82,6 @@ struct gdbarch_tdep
   /* And the size of each entry in the buf.  */
   size_t jb_elt_size;
 
-  /* Cached core file helpers.  */
-  struct regset *gregset;
-  struct regset *fpregset;
-
   /* Types for AdvSISD registers.  */
   struct type *vnq_type;
   struct type *vnd_type;
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 04/23] ARM: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (2 preceding siblings ...)
  2014-04-28  9:44 ` [RFC 03/23] AARCH64: Replace regset_alloc() invocations by static regset structures Andreas Arnez
@ 2014-04-28  9:46 ` Andreas Arnez
  2014-04-28  9:47 ` [RFC 05/23] X86: " Andreas Arnez
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Earnshaw

After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.

gdb/
	* arm-linux-tdep.c (arm_linux_gregset, arm_linux_fpregset)
	(arm_linux_vfpregset): New static regset structures.
	(arm_linux_regset_from_core_section): Remove dynamic allocation of
	regset structures.
	* arm-tdep.h (struct gdbarch_tdep): Remove 'gregset', 'fpregset',
	and 'vfpregset' fields.
---
 gdb/arm-linux-tdep.c | 38 ++++++++++++++++++--------------------
 gdb/arm-tdep.h       |  3 ---
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 98b912b..028a95b 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -686,6 +686,21 @@ arm_linux_collect_vfp (const struct regset *regset,
 			    regs + (regno - ARM_D0_REGNUM) * 8);
 }
 
+static const struct regset arm_linux_gregset =
+  {
+    NULL, arm_linux_supply_gregset, arm_linux_collect_gregset
+  };
+
+static const struct regset arm_linux_fpregset =
+  {
+    NULL, arm_linux_supply_nwfpe, arm_linux_collect_nwfpe
+  };
+
+static const struct regset arm_linux_vfpregset =
+  {
+    NULL, arm_linux_supply_vfp, arm_linux_collect_vfp
+  };
+
 /* Return the appropriate register set for the core section identified
    by SECT_NAME and SECT_SIZE.  */
 
@@ -693,34 +708,17 @@ static const struct regset *
 arm_linux_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 == ARM_LINUX_SIZEOF_GREGSET)
-    {
-      if (tdep->gregset == NULL)
-        tdep->gregset = regset_alloc (gdbarch, arm_linux_supply_gregset,
-                                      arm_linux_collect_gregset);
-      return tdep->gregset;
-    }
+    return &arm_linux_gregset;
 
   if (strcmp (sect_name, ".reg2") == 0
       && sect_size == ARM_LINUX_SIZEOF_NWFPE)
-    {
-      if (tdep->fpregset == NULL)
-        tdep->fpregset = regset_alloc (gdbarch, arm_linux_supply_nwfpe,
-                                       arm_linux_collect_nwfpe);
-      return tdep->fpregset;
-    }
+    return &arm_linux_fpregset;
 
   if (strcmp (sect_name, ".reg-arm-vfp") == 0
       && sect_size == ARM_LINUX_SIZEOF_VFP)
-    {
-      if (tdep->vfpregset == NULL)
-        tdep->vfpregset = regset_alloc (gdbarch, arm_linux_supply_vfp,
-					arm_linux_collect_vfp);
-      return tdep->vfpregset;
-    }
+    return &arm_linux_vfpregset;
 
   return NULL;
 }
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index f8ba122..29669d0 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -193,9 +193,6 @@ struct gdbarch_tdep
   /* Convention for returning structures.  */
   enum struct_return struct_return;
 
-  /* Cached core file helpers.  */
-  struct regset *gregset, *fpregset, *vfpregset;
-
   /* ISA-specific data types.  */
   struct type *arm_ext_type;
   struct type *neon_double_type;
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 05/23] X86: Replace regset_alloc() invocations by static regset structures.
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (3 preceding siblings ...)
  2014-04-28  9:46 ` [RFC 04/23] ARM: " Andreas Arnez
@ 2014-04-28  9:47 ` Andreas Arnez
  2014-04-28 15:33   ` Mark Kettenis
  2014-04-28  9:48 ` [RFC 06/23] MIPS: " Andreas Arnez
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:47 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Kettenis

After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.

gdb/
	* amd64-tdep.c (amd64_fpregset, amd64_xstateregset): New static
	regset structures.
	(amd64_regset_from_core_section): Remove dynamic regset
	allocations.
	* amd64obsd-tdep.c (amd64obsd_supply_regset): Adjust call to
	x86-common regset supply function, now reachable via
	'i386_gregset.supply_regset'.
	(amd64obsd_combined_regset): New static regset structure.
	(amd64obsd_regset_from_core_section): Remove dynamic regset
	allocation.
	* i386-cygwin-tdep.c (i386_windows_regset_from_core_section):
	Likewise.
	* i386-nto-tdep.c (i386nto_supply_gregset): Adjust call to
	x86-common regset supply function.
	* i386-tdep.c (i386_supply_gregset, i386_collect_gregset): Make
	static.
	(i386_gregset): New global regset structure.
	(i386_fpregset, i386_xstateregset): New static regset structures.
	(i386_regset_from_core_section): Remove dynamic regset
	allocations.
	(i386_gdbarch_init): Remove initialization of tdep fields
	'gregset', 'fpregset', and 'xstateregset'.
	* i386-tdep.h (struct gdbarch_tdep): Remove fields 'gregset',
	'fpregset', and 'xstateregset'.
	(i386_supply_gregset, i386_collect_gregset): Remove prototypes.
	(i386_gregset): New declaration.
	* i386obsd-tdep.c (i386obsd_aout_supply_regset): Adjust call to
	x86-common regset supply function.
	(i386obsd_aout_gregset): New static regset structure.
	(i386obsd_aout_regset_from_core_section): Remove dynamic regset
	allocation.
---
 gdb/amd64-tdep.c       | 27 ++++++++++++---------------
 gdb/amd64obsd-tdep.c   | 14 ++++++++------
 gdb/i386-cygwin-tdep.c |  9 +--------
 gdb/i386-nto-tdep.c    |  8 ++------
 gdb/i386-tdep.c        | 48 ++++++++++++++++++++++--------------------------
 gdb/i386-tdep.h        | 21 ++-------------------
 gdb/i386obsd-tdep.c    | 15 ++++++++-------
 7 files changed, 55 insertions(+), 87 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index df4a3f4..b17bc45 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2884,6 +2884,16 @@ amd64_collect_xstateregset (const struct regset *regset,
   amd64_collect_xsave (regcache, regnum, xstateregs, 1);
 }
 
+static const struct regset amd64_fpregset =
+  {
+    NULL, amd64_supply_fpregset, amd64_collect_fpregset
+  };
+
+static const struct regset amd64_xstateregset =
+  {
+    NULL, amd64_supply_xstateregset, amd64_collect_xstateregset
+  };
+
 /* Return the appropriate register set for the core section identified
    by SECT_NAME and SECT_SIZE.  */
 
@@ -2894,23 +2904,10 @@ amd64_regset_from_core_section (struct gdbarch *gdbarch,
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
-    {
-      if (tdep->fpregset == NULL)
-	tdep->fpregset = regset_alloc (gdbarch, amd64_supply_fpregset,
-				       amd64_collect_fpregset);
-
-      return tdep->fpregset;
-    }
+    return &amd64_fpregset;
 
   if (strcmp (sect_name, ".reg-xstate") == 0)
-    {
-      if (tdep->xstateregset == NULL)
-	tdep->xstateregset = regset_alloc (gdbarch,
-					   amd64_supply_xstateregset,
-					   amd64_collect_xstateregset);
-
-      return tdep->xstateregset;
-    }
+    return &amd64_xstateregset;
 
   return i386_regset_from_core_section (gdbarch, sect_name, sect_size);
 }
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index c5ed731..e7041c9 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -49,11 +49,17 @@ amd64obsd_supply_regset (const struct regset *regset,
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
 
-  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
+  i386_gregset.supply_regset (regset, regcache, regnum, regs,
+			      tdep->sizeof_gregset);
   amd64_supply_fxsave (regcache, regnum,
 		       ((const gdb_byte *)regs) + tdep->sizeof_gregset);
 }
 
+static const struct regset amd64obsd_combined_regset =
+  {
+    NULL, amd64obsd_supply_regset, NULL
+  };
+
 static const struct regset *
 amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
 				    const char *sect_name, size_t sect_size)
@@ -65,11 +71,7 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch,
 
   if (strcmp (sect_name, ".reg") == 0
       && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE)
-    {
-      if (tdep->gregset == NULL)
-        tdep->gregset = regset_alloc (gdbarch, amd64obsd_supply_regset, NULL);
-      return tdep->gregset;
-    }
+    return &amd64obsd_combined_regset;
 
   return NULL;
 }
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 7b7785a..a23f80e 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -96,16 +96,9 @@ static const struct regset *
 i386_windows_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 == I386_WINDOWS_SIZEOF_GREGSET)
-    {
-      if (tdep->gregset == NULL)
-        tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
-                                      i386_collect_gregset);
-      return tdep->gregset;
-    }
+    return &i386_gregset;
 
   return NULL;
 }
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 8d8ba10..d005914 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -82,13 +82,9 @@ i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  if(tdep->gregset == NULL)
-    tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
-				  i386_collect_gregset);
-
   gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
-  tdep->gregset->supply_regset (tdep->gregset, regcache, -1,
-				gpregs, NUM_GPREGS * 4);
+  i386_gregset.supply_regset (&i386_gregset, regcache, -1,
+			      gpregs, NUM_GPREGS * 4);
 }
 
 static void
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index de783f6..bee27f8 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3720,7 +3720,7 @@ i386_value_to_register (struct frame_info *frame, int regnum,
    in the general-purpose register set REGSET to register cache
    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
 
-void
+static void
 i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *gregs, size_t len)
 {
@@ -3743,7 +3743,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
    general-purpose register set REGSET.  If REGNUM is -1, do this for
    all registers in REGSET.  */
 
-void
+static void
 i386_collect_gregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *gregs, size_t len)
@@ -3824,6 +3824,23 @@ i386_collect_xstateregset (const struct regset *regset,
   i387_collect_xsave (regcache, regnum, xstateregs, 1);
 }
 
+/* Register set definitions.  */
+
+const struct regset i386_gregset =
+  {
+    NULL, i386_supply_gregset, i386_collect_gregset
+  };
+
+static const struct regset i386_fpregset =
+  {
+    NULL, i386_supply_fpregset, i386_collect_fpregset
+  };
+
+static const struct regset i386_xstateregset =
+  {
+    NULL, i386_supply_xstateregset, i386_collect_xstateregset
+  };
+
 /* Return the appropriate register set for the core section identified
    by SECT_NAME and SECT_SIZE.  */
 
@@ -3834,32 +3851,15 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
-    {
-      if (tdep->gregset == NULL)
-	tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
-				      i386_collect_gregset);
-      return tdep->gregset;
-    }
+      return &i386_gregset;
 
   if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
       || (strcmp (sect_name, ".reg-xfp") == 0
 	  && sect_size == I387_SIZEOF_FXSAVE))
-    {
-      if (tdep->fpregset == NULL)
-	tdep->fpregset = regset_alloc (gdbarch, i386_supply_fpregset,
-				       i386_collect_fpregset);
-      return tdep->fpregset;
-    }
+    return &i386_fpregset;
 
   if (strcmp (sect_name, ".reg-xstate") == 0)
-    {
-      if (tdep->xstateregset == NULL)
-	tdep->xstateregset = regset_alloc (gdbarch,
-					   i386_supply_xstateregset,
-					   i386_collect_xstateregset);
-
-      return tdep->xstateregset;
-    }
+    return &i386_xstateregset;
 
   return NULL;
 }
@@ -8283,17 +8283,13 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   gdbarch = gdbarch_alloc (&info, tdep);
 
   /* General-purpose registers.  */
-  tdep->gregset = NULL;
   tdep->gregset_reg_offset = NULL;
   tdep->gregset_num_regs = I386_NUM_GREGS;
   tdep->sizeof_gregset = 0;
 
   /* Floating-point registers.  */
-  tdep->fpregset = NULL;
   tdep->sizeof_fpregset = I387_SIZEOF_FSAVE;
 
-  tdep->xstateregset = NULL;
-
   /* The default settings include the FPU registers, the MMX registers
      and the SSE registers.  This can be overridden for a specific ABI
      by adjusting the members `st0_regnum', `mm0_regnum' and
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 2ada2bd..fd601f2 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -56,18 +56,13 @@ enum struct_return
 struct gdbarch_tdep
 {
   /* General-purpose registers.  */
-  struct regset *gregset;
   int *gregset_reg_offset;
   int gregset_num_regs;
   size_t sizeof_gregset;
 
   /* Floating-point registers.  */
-  struct regset *fpregset;
   size_t sizeof_fpregset;
 
-  /* XSAVE extended state.  */
-  struct regset *xstateregset;
-
   /* Register number for %st(0).  The register numbers for the other
      registers follow from this one.  Set this to -1 to indicate the
      absence of an FPU.  */
@@ -382,20 +377,8 @@ extern int i386_sigtramp_p (struct frame_info *this_frame);
 extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 				     struct reggroup *group);
 
-/* Supply register REGNUM from the general-purpose register set REGSET
-   to register cache REGCACHE.  If REGNUM is -1, do this for all
-   registers in REGSET.  */
-extern void i386_supply_gregset (const struct regset *regset,
-				 struct regcache *regcache, int regnum,
-				 const void *gregs, size_t len);
-
-/* Collect register REGNUM from the register cache REGCACHE and store
-   it in the buffer specified by GREGS and LEN as described by the
-   general-purpose register set REGSET.  If REGNUM is -1, do this for
-   all registers in REGSET.  */
-extern void i386_collect_gregset (const struct regset *regset,
-				  const struct regcache *regcache,
-				  int regnum, void *gregs, size_t len);
+/* General-purpose register set. */
+extern const struct regset i386_gregset;
 
 /* Return the appropriate register set for the core section identified
    by SECT_NAME and SECT_SIZE.  */
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index bc29606..46b4719 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -147,10 +147,16 @@ i386obsd_aout_supply_regset (const struct regset *regset,
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
 
-  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
+  i386_gregset.supply_regset (regset, regcache, regnum, regs,
+			      tdep->sizeof_gregset);
   i387_supply_fsave (regcache, regnum, gregs + tdep->sizeof_gregset);
 }
 
+static const struct regset i386obsd_aout_gregset =
+  {
+    NULL, i386obsd_aout_supply_regset, NULL
+  };
+
 static const struct regset *
 i386obsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
 					const char *sect_name,
@@ -163,12 +169,7 @@ i386obsd_aout_regset_from_core_section (struct gdbarch *gdbarch,
 
   if (strcmp (sect_name, ".reg") == 0
       && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE)
-    {
-      if (tdep->gregset == NULL)
-        tdep->gregset =
-	  regset_alloc (gdbarch, i386obsd_aout_supply_regset, NULL);
-      return tdep->gregset;
-    }
+    return &i386obsd_aout_gregset;
 
   return NULL;
 }
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 06/23] MIPS: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (4 preceding siblings ...)
  2014-04-28  9:47 ` [RFC 05/23] X86: " Andreas Arnez
@ 2014-04-28  9:48 ` Andreas Arnez
  2014-04-28  9:49 ` [RFC 07/23] MN10300: " Andreas Arnez
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Maciej W. Rozycki, Daniel Jacobowitz

After removal of the regset_alloc invocations, the appropriate tdep
fields become obsolete and are thus removed.

gdb/
	* mips-linux-tdep.c (mips_linux_gregset, mips64_linux_gregset)
	(mips_linux_fpregset, mips64_linux_fpregset): New static regset
	structures.
	(mips_linux_regset_from_core_section): Remove dynamic regset
	allocations.
	* mips-tdep.h (struct gdbarch_tdep): Remove fields 'gregset',
	'gregset64', 'fpregset', and 'fpregset64'.
	* mips-tdep.c (mips_gdbarch_init): Remove initialization of
	deleted tdep fields.
---
 gdb/mips-linux-tdep.c | 53 +++++++++++++++++++++++----------------------------
 gdb/mips-tdep.c       |  4 ----
 gdb/mips-tdep.h       |  8 --------
 3 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 61bea6c..a975db6 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -618,11 +618,30 @@ mips64_fill_fpregset_wrapper (const struct regset *regset,
   mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *)gregs, regnum);
 }
 
+static const struct regset mips_linux_gregset =
+  {
+    NULL, mips_supply_gregset_wrapper, mips_fill_gregset_wrapper
+  };
+
+static const struct regset mips64_linux_gregset =
+  {
+    NULL, mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper
+  };
+
+static const struct regset mips_linux_fpregset =
+  {
+    NULL, mips_supply_fpregset_wrapper, mips_fill_fpregset_wrapper
+  };
+
+static const struct regset mips64_linux_fpregset =
+  {
+    NULL, mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper
+  };
+
 static const struct regset *
 mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
 				     const char *sect_name, size_t sect_size)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   mips_elf_gregset_t gregset;
   mips_elf_fpregset_t fpregset;
   mips64_elf_gregset_t gregset64;
@@ -631,21 +650,9 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
   if (strcmp (sect_name, ".reg") == 0)
     {
       if (sect_size == sizeof (gregset))
-	{
-	  if (tdep->gregset == NULL)
-	    tdep->gregset = regset_alloc (gdbarch,
-					  mips_supply_gregset_wrapper,
-					  mips_fill_gregset_wrapper);
-	  return tdep->gregset;
-	}
+	return &mips_linux_gregset;
       else if (sect_size == sizeof (gregset64))
-	{
-	  if (tdep->gregset64 == NULL)
-	    tdep->gregset64 = regset_alloc (gdbarch,
-					    mips64_supply_gregset_wrapper,
-					    mips64_fill_gregset_wrapper);
-	  return tdep->gregset64;
-	}
+	return &mips64_linux_gregset;
       else
 	{
 	  warning (_("wrong size gregset struct in core file"));
@@ -654,21 +661,9 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch,
   else if (strcmp (sect_name, ".reg2") == 0)
     {
       if (sect_size == sizeof (fpregset))
-	{
-	  if (tdep->fpregset == NULL)
-	    tdep->fpregset = regset_alloc (gdbarch,
-					   mips_supply_fpregset_wrapper,
-					   mips_fill_fpregset_wrapper);
-	  return tdep->fpregset;
-	}
+	return &mips_linux_fpregset;
       else if (sect_size == sizeof (fpregset64))
-	{
-	  if (tdep->fpregset64 == NULL)
-	    tdep->fpregset64 = regset_alloc (gdbarch,
-					     mips64_supply_fpregset_wrapper,
-					     mips64_fill_fpregset_wrapper);
-	  return tdep->fpregset64;
-	}
+	return &mips64_linux_fpregset;
       else
 	{
 	  warning (_("wrong size fpregset struct in core file"));
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 606b150..c3e8e77 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8327,10 +8327,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep->mips_fpu_type = fpu_type;
   tdep->register_size_valid_p = 0;
   tdep->register_size = 0;
-  tdep->gregset = NULL;
-  tdep->gregset64 = NULL;
-  tdep->fpregset = NULL;
-  tdep->fpregset64 = NULL;
 
   if (info.target_desc)
     {
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index 31e9601..ba29952 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -109,14 +109,6 @@ struct gdbarch_tdep
   int register_size_valid_p;
   int register_size;
 
-  /* General-purpose registers.  */
-  struct regset *gregset;
-  struct regset *gregset64;
-
-  /* Floating-point registers.  */
-  struct regset *fpregset;
-  struct regset *fpregset64;
-
   /* Return the expected next PC if FRAME is stopped at a syscall
      instruction.  */
   CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 07/23] MN10300: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (5 preceding siblings ...)
  2014-04-28  9:48 ` [RFC 06/23] MIPS: " Andreas Arnez
@ 2014-04-28  9:49 ` Andreas Arnez
  2014-04-28  9:50 ` [RFC 08/23] SCORE: Replace regset_alloc() invocation by a static regset structure Andreas Arnez
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kevin Buettner

On this architecture the change may fix a small memory leak.

gdb/
	* mn10300-linux-tdep.c (am33_gregset, am33_fpregset): New static
	regset structures.
	(am33_regset_from_core_section): Remove dynamic regset
	allocations.
---
 gdb/mn10300-linux-tdep.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 6acae56..4377463 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -451,6 +451,16 @@ am33_collect_fpregset_method (const struct regset *regset,
   return;
 }
 
+static const struct regset am33_gregset =
+  {
+    NULL, am33_supply_gregset_method, am33_collect_gregset_method
+  };
+
+static const struct regset am33_fpregset =
+  {
+    NULL, am33_supply_fpregset_method, am33_collect_fpregset_method
+  };
+
 /* Create a struct regset from a corefile register section.  */
 
 static const struct regset *
@@ -458,17 +468,10 @@ am33_regset_from_core_section (struct gdbarch *gdbarch,
 			       const char *sect_name, 
 			       size_t sect_size)
 {
-  /* We will call regset_alloc, and pass the names of the supply and
-     collect methods.  */
-
   if (sect_size == sizeof (mn10300_elf_fpregset_t))
-    return regset_alloc (gdbarch, 
-			 am33_supply_fpregset_method,
-			 am33_collect_fpregset_method);
+    return &am33_fpregset;
   else
-    return regset_alloc (gdbarch, 
-			 am33_supply_gregset_method,
-			 am33_collect_gregset_method);
+    return &am33_gregset;
 }
 \f
 static void
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 08/23] SCORE: Replace regset_alloc() invocation by a static regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (6 preceding siblings ...)
  2014-04-28  9:49 ` [RFC 07/23] MN10300: " Andreas Arnez
@ 2014-04-28  9:50 ` Andreas Arnez
  2014-04-28  9:51 ` [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap" Andreas Arnez
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: Qinwei

Since this changes makes the only member of the tdep structure
obsolete, the tdep structure is removed.

gdb/
	* score-tdep.c (score7_linux_gregset): New static regset
	structure.
	(score7_linux_regset_from_core_section): Remove dynamic regset
	allocation.
	(score_gdbarch_init): Drop allocation of tdep structure.
	* score-tdep.h (struct gdbarch_tdep): Remove declaration.
---
 gdb/score-tdep.c | 21 ++++++++-------------
 gdb/score-tdep.h |  7 -------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 078315a..c224189 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -1447,6 +1447,12 @@ score7_linux_supply_gregset(const struct regset *regset,
   }
 }
 
+static const struct regset score7_linux_gregset =
+  {
+    NULL,
+    score7_linux_supply_gregset, NULL
+  };
+
 /* Return the appropriate register set from the core section identified
    by SECT_NAME and SECT_SIZE.  */
 
@@ -1454,20 +1460,11 @@ static const struct regset *
 score7_linux_regset_from_core_section(struct gdbarch *gdbarch,
                     const char *sect_name, size_t sect_size)
 {
-  struct gdbarch_tdep *tdep;
-
   gdb_assert (gdbarch != NULL);
   gdb_assert (sect_name != NULL);
 
-  tdep = gdbarch_tdep (gdbarch);
-
   if (strcmp(sect_name, ".reg") == 0 && sect_size == sizeof(elf_gregset_t))
-    {
-      if (tdep->gregset == NULL)
-	tdep->gregset = regset_alloc (gdbarch,
-				      score7_linux_supply_gregset, NULL);
-      return tdep->gregset;
-    }
+    return &score7_linux_gregset;
 
   return NULL;
 }
@@ -1476,7 +1473,6 @@ static struct gdbarch *
 score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   struct gdbarch *gdbarch;
-  struct gdbarch_tdep *tdep;
   target_mach = info.bfd_arch_info->mach;
 
   arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -1484,8 +1480,7 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     {
       return (arches->gdbarch);
     }
-  tdep = xcalloc(1, sizeof(struct gdbarch_tdep));
-  gdbarch = gdbarch_alloc (&info, tdep);
+  gdbarch = gdbarch_alloc (&info, NULL);
 
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
diff --git a/gdb/score-tdep.h b/gdb/score-tdep.h
index b34f5a9..02a334e 100644
--- a/gdb/score-tdep.h
+++ b/gdb/score-tdep.h
@@ -49,13 +49,6 @@ enum gdb_regnum
 /* Forward declarations.  */
 struct regset;
 
-/* Target-dependent structure in gdbarch */
-struct gdbarch_tdep
-{
-    /* Cached core file helpers.  */
-    struct regset *gregset;
-};
-
 /* Linux Core file support (dirty hack)
   
    S+core Linux register set definition, copy from S+core Linux.  */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap"
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (7 preceding siblings ...)
  2014-04-28  9:50 ` [RFC 08/23] SCORE: Replace regset_alloc() invocation by a static regset structure Andreas Arnez
@ 2014-04-28  9:51 ` Andreas Arnez
  2014-05-05  9:50   ` Mark Kettenis
  2014-04-28  9:52 ` [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures Andreas Arnez
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Kettenis

As a preparation for the next patch in this series, this patch clears
the naming confusion about "regset" versus "sparc*regset".  The latter
was used to represent the *map* of a register set, not the register
set itself, and is thus renamed accordingly.

The following identifiers are renamed:

  sparc32_bsd_fpregset => sparc32_bsd_fpregmap
  sparc32_linux_core_gregset => sparc32_linux_core_gregmap
  sparc32_sol2_fpregset => sparc32_sol2_fpregmap
  sparc32_sol2_gregset => sparc32_sol2_gregmap
  sparc32_sunos4_fpregset => sparc32_sunos4_fpregmap
  sparc32_sunos4_gregset => sparc32_sunos4_gregmap
  sparc32nbsd_gregset => sparc32nbsd_gregmap
  sparc64_bsd_fpregset => sparc64_bsd_fpregmap
  sparc64_linux_core_gregset => sparc64_linux_core_gregmap
  sparc64_linux_ptrace_gregset => sparc64_linux_ptrace_gregmap
  sparc64_sol2_fpregset => sparc64_sol2_fpregmap
  sparc64_sol2_gregset => sparc64_sol2_gregmap
  sparc64fbsd_gregset => sparc64fbsd_gregmap
  sparc64nbsd_gregset => sparc64nbsd_gregmap
  sparc64obsd_core_gregset => sparc64obsd_core_gregmap
  sparc64obsd_gregset => sparc64obsd_gregmap
  sparc_fpregset => sparc_fpregmap
  sparc_gregset => sparc_gregmap
  sparc_sol2_fpregset => sparc_sol2_fpregmap
  sparc_sol2_gregset => sparc_sol2_gregmap

Also, all local variables 'gregset' and 'fpregset' are renamed to
'gregmap' and 'fpregmap', respectively.

The patch was generated with the following Perl script:

#!/usr/bin/perl

my %renamed;

sub rename_maybe($)
{
    my ($w) = @_;
    return $w if $w =~ /_(?:supply|collect)_/;
    unless (defined $renamed{$w}) {
    ($renamed{$w} = $w) =~ s/regset$/regmap/;
    }
    return $renamed{$w};
}

while (my $file = shift) {
    rename $file, "$file~";
    open my $in, '<', "$file~";
    open my $out, '>', $file;

    while (<$in>) {
    s/\b(sparc\w*regset)\b/rename_maybe($1)/eg;
    s/(regmap\s+\*)(g|fp)regset/$1$2regmap/g;
    s/([* ([])\b(g|fp)regset\b/$1$2regmap/g
	if $file =~ /\.c$/;
    print $out $_;
    }
    close $out;
    close $in;
}

open my $log, '>', "sparc-rename.log";

for my $word (sort {$a cmp $b} keys %renamed) {
    print $log "$word => " . $renamed{$word} . "\n";
}
---
 gdb/sparc-linux-nat.c    | 10 +++---
 gdb/sparc-linux-tdep.c   | 10 +++---
 gdb/sparc-nat.c          | 28 ++++++++---------
 gdb/sparc-nat.h          | 16 +++++-----
 gdb/sparc-sol2-nat.c     | 16 +++++-----
 gdb/sparc-sol2-tdep.c    |  4 +--
 gdb/sparc-tdep.c         | 50 ++++++++++++++---------------
 gdb/sparc-tdep.h         | 24 +++++++-------
 gdb/sparc64-linux-nat.c  | 14 ++++-----
 gdb/sparc64-linux-tdep.c | 10 +++---
 gdb/sparc64-sol2-tdep.c  |  4 +--
 gdb/sparc64-tdep.c       | 82 ++++++++++++++++++++++++------------------------
 gdb/sparc64-tdep.h       | 20 ++++++------
 gdb/sparc64fbsd-nat.c    |  2 +-
 gdb/sparc64fbsd-tdep.c   | 10 +++---
 gdb/sparc64nbsd-nat.c    | 24 +++++++-------
 gdb/sparc64nbsd-tdep.c   |  6 ++--
 gdb/sparc64obsd-nat.c    |  4 +--
 gdb/sparc64obsd-tdep.c   | 12 +++----
 gdb/sparcnbsd-nat.c      |  4 +--
 gdb/sparcnbsd-tdep.c     |  8 ++---
 21 files changed, 179 insertions(+), 179 deletions(-)

diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c
index a01c3b3..0e2fa85 100644
--- a/gdb/sparc-linux-nat.c
+++ b/gdb/sparc-linux-nat.c
@@ -31,26 +31,26 @@
 void
 supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
 {
-  sparc32_supply_gregset (sparc_gregset, regcache, -1, gregs);
+  sparc32_supply_gregset (sparc_gregmap, regcache, -1, gregs);
 }
 
 void
 supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
 {
-  sparc32_supply_fpregset (sparc_fpregset, regcache, -1, fpregs);
+  sparc32_supply_fpregset (sparc_fpregmap, regcache, -1, fpregs);
 }
 
 void
 fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
 {
-  sparc32_collect_gregset (sparc_gregset, regcache, regnum, gregs);
+  sparc32_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
 }
 
 void
 fill_fpregset (const struct regcache *regcache,
 	       prfpregset_t *fpregs, int regnum)
 {
-  sparc32_collect_fpregset (sparc_fpregset, regcache, regnum, fpregs);
+  sparc32_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs);
 }
 
 void _initialize_sparc_linux_nat (void);
@@ -63,7 +63,7 @@ _initialize_sparc_linux_nat (void)
   /* Fill in the generic GNU/Linux methods.  */
   t = linux_target ();
 
-  sparc_fpregset = &sparc32_bsd_fpregset;
+  sparc_fpregmap = &sparc32_bsd_fpregmap;
 
   /* Add our register access methods.  */
   t->to_fetch_registers = sparc_fetch_inferior_registers;
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 713169a..4a193e2 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -198,7 +198,7 @@ sparc32_linux_step_trap (struct frame_info *frame, unsigned long insn)
 }
 \f
 
-const struct sparc_gregset sparc32_linux_core_gregset =
+const struct sparc_gregmap sparc32_linux_core_gregmap =
 {
   32 * 4,			/* %psr */
   33 * 4,			/* %pc */
@@ -217,7 +217,7 @@ sparc32_linux_supply_core_gregset (const struct regset *regset,
 				   struct regcache *regcache,
 				   int regnum, const void *gregs, size_t len)
 {
-  sparc32_supply_gregset (&sparc32_linux_core_gregset,
+  sparc32_supply_gregset (&sparc32_linux_core_gregmap,
 			  regcache, regnum, gregs);
 }
 
@@ -226,7 +226,7 @@ sparc32_linux_collect_core_gregset (const struct regset *regset,
 				    const struct regcache *regcache,
 				    int regnum, void *gregs, size_t len)
 {
-  sparc32_collect_gregset (&sparc32_linux_core_gregset,
+  sparc32_collect_gregset (&sparc32_linux_core_gregmap,
 			   regcache, regnum, gregs);
 }
 
@@ -235,7 +235,7 @@ sparc32_linux_supply_core_fpregset (const struct regset *regset,
 				    struct regcache *regcache,
 				    int regnum, const void *fpregs, size_t len)
 {
-  sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
+  sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 static void
@@ -243,7 +243,7 @@ sparc32_linux_collect_core_fpregset (const struct regset *regset,
 				     const struct regcache *regcache,
 				     int regnum, void *fpregs, size_t len)
 {
-  sparc32_collect_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
+  sparc32_collect_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 /* Set the program counter for process PTID to PC.  */
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index 77054d1..22e1e5f 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -81,15 +81,15 @@ typedef struct fp_status fpregset_t;
 #endif
 
 /* Register set description.  */
-const struct sparc_gregset *sparc_gregset;
-const struct sparc_fpregset *sparc_fpregset;
-void (*sparc_supply_gregset) (const struct sparc_gregset *,
+const struct sparc_gregmap *sparc_gregmap;
+const struct sparc_fpregmap *sparc_fpregmap;
+void (*sparc_supply_gregset) (const struct sparc_gregmap *,
 			      struct regcache *, int , const void *);
-void (*sparc_collect_gregset) (const struct sparc_gregset *,
+void (*sparc_collect_gregset) (const struct sparc_gregmap *,
 			       const struct regcache *, int, void *);
-void (*sparc_supply_fpregset) (const struct sparc_fpregset *,
+void (*sparc_supply_fpregset) (const struct sparc_fpregmap *,
 			       struct regcache *, int , const void *);
-void (*sparc_collect_fpregset) (const struct sparc_fpregset *,
+void (*sparc_collect_fpregset) (const struct sparc_fpregmap *,
 				const struct regcache *, int , void *);
 int (*sparc_gregset_supplies_p) (struct gdbarch *, int);
 int (*sparc_fpregset_supplies_p) (struct gdbarch *, int);
@@ -174,7 +174,7 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
       if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
-      sparc_supply_gregset (sparc_gregset, regcache, -1, &regs);
+      sparc_supply_gregset (sparc_gregmap, regcache, -1, &regs);
       if (regnum != -1)
 	return;
     }
@@ -186,7 +186,7 @@ sparc_fetch_inferior_registers (struct target_ops *ops,
       if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
-      sparc_supply_fpregset (sparc_fpregset, regcache, -1, &fpregs);
+      sparc_supply_fpregset (sparc_fpregmap, regcache, -1, &fpregs);
     }
 }
 
@@ -210,7 +210,7 @@ sparc_store_inferior_registers (struct target_ops *ops,
       if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
-      sparc_collect_gregset (sparc_gregset, regcache, regnum, &regs);
+      sparc_collect_gregset (sparc_gregmap, regcache, regnum, &regs);
 
       if (ptrace (PTRACE_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
 	perror_with_name (_("Couldn't write registers"));
@@ -237,7 +237,7 @@ sparc_store_inferior_registers (struct target_ops *ops,
 	perror_with_name (_("Couldn't get floating-point registers"));
 
       memcpy (&saved_fpregs, &fpregs, sizeof (fpregs));
-      sparc_collect_fpregset (sparc_fpregset, regcache, regnum, &fpregs);
+      sparc_collect_fpregset (sparc_fpregmap, regcache, regnum, &fpregs);
 
       /* Writing the floating-point registers will fail on NetBSD with
 	 EINVAL if the inferior process doesn't have an FPU state
@@ -352,10 +352,10 @@ void
 _initialize_sparc_nat (void)
 {
   /* Deafult to using SunOS 4 register sets.  */
-  if (sparc_gregset == NULL)
-    sparc_gregset = &sparc32_sunos4_gregset;
-  if (sparc_fpregset == NULL)
-    sparc_fpregset = &sparc32_sunos4_fpregset;
+  if (sparc_gregmap == NULL)
+    sparc_gregmap = &sparc32_sunos4_gregmap;
+  if (sparc_fpregmap == NULL)
+    sparc_fpregmap = &sparc32_sunos4_fpregmap;
   if (sparc_supply_gregset == NULL)
     sparc_supply_gregset = sparc32_supply_gregset;
   if (sparc_collect_gregset == NULL)
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index f40e4bd..d1283af 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -20,18 +20,18 @@
 #ifndef SPARC_NAT_H
 #define SPARC_NAT_H 1
 
-struct sparc_gregset;
-struct sparc_fpregset;
+struct sparc_gregmap;
+struct sparc_fpregmap;
 
-extern const struct sparc_gregset *sparc_gregset;
-extern const struct sparc_fpregset *sparc_fpregset;
-extern void (*sparc_supply_gregset) (const struct sparc_gregset *,
+extern const struct sparc_gregmap *sparc_gregmap;
+extern const struct sparc_fpregmap *sparc_fpregmap;
+extern void (*sparc_supply_gregset) (const struct sparc_gregmap *,
 				     struct regcache *, int , const void *);
-extern void (*sparc_collect_gregset) (const struct sparc_gregset *,
+extern void (*sparc_collect_gregset) (const struct sparc_gregmap *,
 				      const struct regcache *, int, void *);
-extern void (*sparc_supply_fpregset) (const struct sparc_fpregset *,
+extern void (*sparc_supply_fpregset) (const struct sparc_fpregmap *,
 				      struct regcache *, int , const void *);
-extern void (*sparc_collect_fpregset) (const struct sparc_fpregset *,
+extern void (*sparc_collect_fpregset) (const struct sparc_fpregmap *,
 				       const struct regcache *, int , void *);
 extern int (*sparc_gregset_supplies_p) (struct gdbarch *gdbarch, int);
 extern int (*sparc_fpregset_supplies_p) (struct gdbarch *gdbarch, int);
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index 925f786..825f4b5 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -58,8 +58,8 @@
 #define sparc_collect_gregset sparc64_collect_gregset
 #define sparc_collect_fpregset sparc64_collect_fpregset
 
-#define sparc_sol2_gregset sparc64_sol2_gregset
-#define sparc_sol2_fpregset sparc64_sol2_fpregset
+#define sparc_sol2_gregmap sparc64_sol2_gregmap
+#define sparc_sol2_fpregmap sparc64_sol2_fpregmap
 
 #else
 
@@ -68,34 +68,34 @@
 #define sparc_collect_gregset sparc32_collect_gregset
 #define sparc_collect_fpregset sparc32_collect_fpregset
 
-#define sparc_sol2_gregset sparc32_sol2_gregset
-#define sparc_sol2_fpregset sparc32_sol2_fpregset
+#define sparc_sol2_gregmap sparc32_sol2_gregmap
+#define sparc_sol2_fpregmap sparc32_sol2_fpregmap
 
 #endif
 
 void
 supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
 {
-  sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
+  sparc_supply_gregset (&sparc_sol2_gregmap, regcache, -1, gregs);
 }
 
 void
 supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
 {
-  sparc_supply_fpregset (&sparc_sol2_fpregset, regcache, -1, fpregs);
+  sparc_supply_fpregset (&sparc_sol2_fpregmap, regcache, -1, fpregs);
 }
 
 void
 fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
 {
-  sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
+  sparc_collect_gregset (&sparc_sol2_gregmap, regcache, regnum, gregs);
 }
 
 void
 fill_fpregset (const struct regcache *regcache,
 	       prfpregset_t *fpregs, int regnum)
 {
-  sparc_collect_fpregset (&sparc_sol2_fpregset, regcache, regnum, fpregs);
+  sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index 381adf9..4452c00 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -36,7 +36,7 @@
 #include "solib-svr4.h"
 
 /* From <sys/regset.h>.  */
-const struct sparc_gregset sparc32_sol2_gregset =
+const struct sparc_gregmap sparc32_sol2_gregmap =
 {
   32 * 4,			/* %psr */
   33 * 4,			/* %pc */
@@ -48,7 +48,7 @@ const struct sparc_gregset sparc32_sol2_gregset =
   16 * 4,			/* %l0 */
 };
 
-const struct sparc_fpregset sparc32_sol2_fpregset =
+const struct sparc_fpregmap sparc32_sol2_fpregmap =
 {
   0 * 4,			/* %f0 */
   33 * 4,			/* %fsr */
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 311a156..e7b3090 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1898,7 +1898,7 @@ sparc_collect_rwindow (const struct regcache *regcache,
 /* Helper functions for dealing with register sets.  */
 
 void
-sparc32_supply_gregset (const struct sparc_gregset *gregset,
+sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
 			struct regcache *regcache,
 			int regnum, const void *gregs)
 {
@@ -1908,26 +1908,26 @@ sparc32_supply_gregset (const struct sparc_gregset *gregset,
 
   if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC32_PSR_REGNUM,
-			 regs + gregset->r_psr_offset);
+			 regs + gregmap->r_psr_offset);
 
   if (regnum == SPARC32_PC_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC32_PC_REGNUM,
-			 regs + gregset->r_pc_offset);
+			 regs + gregmap->r_pc_offset);
 
   if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC32_NPC_REGNUM,
-			 regs + gregset->r_npc_offset);
+			 regs + gregmap->r_npc_offset);
 
   if (regnum == SPARC32_Y_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC32_Y_REGNUM,
-			 regs + gregset->r_y_offset);
+			 regs + gregmap->r_y_offset);
 
   if (regnum == SPARC_G0_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC_G0_REGNUM, &zero);
 
   if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
     {
-      int offset = gregset->r_g1_offset;
+      int offset = gregmap->r_g1_offset;
 
       for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
 	{
@@ -1941,7 +1941,7 @@ sparc32_supply_gregset (const struct sparc_gregset *gregset,
     {
       /* Not all of the register set variants include Locals and
          Inputs.  For those that don't, we read them off the stack.  */
-      if (gregset->r_l0_offset == -1)
+      if (gregmap->r_l0_offset == -1)
 	{
 	  ULONGEST sp;
 
@@ -1950,7 +1950,7 @@ sparc32_supply_gregset (const struct sparc_gregset *gregset,
 	}
       else
 	{
-	  int offset = gregset->r_l0_offset;
+	  int offset = gregmap->r_l0_offset;
 
 	  for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
 	    {
@@ -1963,7 +1963,7 @@ sparc32_supply_gregset (const struct sparc_gregset *gregset,
 }
 
 void
-sparc32_collect_gregset (const struct sparc_gregset *gregset,
+sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
 			 const struct regcache *regcache,
 			 int regnum, void *gregs)
 {
@@ -1972,23 +1972,23 @@ sparc32_collect_gregset (const struct sparc_gregset *gregset,
 
   if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
     regcache_raw_collect (regcache, SPARC32_PSR_REGNUM,
-			  regs + gregset->r_psr_offset);
+			  regs + gregmap->r_psr_offset);
 
   if (regnum == SPARC32_PC_REGNUM || regnum == -1)
     regcache_raw_collect (regcache, SPARC32_PC_REGNUM,
-			  regs + gregset->r_pc_offset);
+			  regs + gregmap->r_pc_offset);
 
   if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
     regcache_raw_collect (regcache, SPARC32_NPC_REGNUM,
-			  regs + gregset->r_npc_offset);
+			  regs + gregmap->r_npc_offset);
 
   if (regnum == SPARC32_Y_REGNUM || regnum == -1)
     regcache_raw_collect (regcache, SPARC32_Y_REGNUM,
-			  regs + gregset->r_y_offset);
+			  regs + gregmap->r_y_offset);
 
   if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
     {
-      int offset = gregset->r_g1_offset;
+      int offset = gregmap->r_g1_offset;
 
       /* %g0 is always zero.  */
       for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
@@ -2003,9 +2003,9 @@ sparc32_collect_gregset (const struct sparc_gregset *gregset,
     {
       /* Not all of the register set variants include Locals and
          Inputs.  For those that don't, we read them off the stack.  */
-      if (gregset->r_l0_offset != -1)
+      if (gregmap->r_l0_offset != -1)
 	{
-	  int offset = gregset->r_l0_offset;
+	  int offset = gregmap->r_l0_offset;
 
 	  for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
 	    {
@@ -2018,7 +2018,7 @@ sparc32_collect_gregset (const struct sparc_gregset *gregset,
 }
 
 void
-sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
+sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 			 struct regcache *regcache,
 			 int regnum, const void *fpregs)
 {
@@ -2029,16 +2029,16 @@ sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
 	regcache_raw_supply (regcache, SPARC_F0_REGNUM + i,
-			     regs + fpregset->r_f0_offset + (i * 4));
+			     regs + fpregmap->r_f0_offset + (i * 4));
     }
 
   if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
     regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
-			 regs + fpregset->r_fsr_offset);
+			 regs + fpregmap->r_fsr_offset);
 }
 
 void
-sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
+sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 			  const struct regcache *regcache,
 			  int regnum, void *fpregs)
 {
@@ -2049,19 +2049,19 @@ sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
 	regcache_raw_collect (regcache, SPARC_F0_REGNUM + i,
-			      regs + fpregset->r_f0_offset + (i * 4));
+			      regs + fpregmap->r_f0_offset + (i * 4));
     }
 
   if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
     regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
-			  regs + fpregset->r_fsr_offset);
+			  regs + fpregmap->r_fsr_offset);
 }
 \f
 
 /* SunOS 4.  */
 
 /* From <machine/reg.h>.  */
-const struct sparc_gregset sparc32_sunos4_gregset =
+const struct sparc_gregmap sparc32_sunos4_gregmap =
 {
   0 * 4,			/* %psr */
   1 * 4,			/* %pc */
@@ -2073,13 +2073,13 @@ const struct sparc_gregset sparc32_sunos4_gregset =
   -1				/* %l0 */
 };
 
-const struct sparc_fpregset sparc32_sunos4_fpregset =
+const struct sparc_fpregmap sparc32_sunos4_fpregmap =
 {
   0 * 4,			/* %f0 */
   33 * 4,			/* %fsr */
 };
 
-const struct sparc_fpregset sparc32_bsd_fpregset =
+const struct sparc_fpregmap sparc32_bsd_fpregmap =
 {
   0 * 4,			/* %f0 */
   32 * 4,			/* %fsr */
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index a065ebe..12c8ef7 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -28,7 +28,7 @@ struct trad_frame_saved_reg;
 
 /* Register offsets for the general-purpose register set.  */
 
-struct sparc_gregset
+struct sparc_gregmap
 {
   int r_psr_offset;
   int r_pc_offset;
@@ -41,7 +41,7 @@ struct sparc_gregset
   int r_y_size;
 };
 
-struct sparc_fpregset
+struct sparc_fpregmap
 {
   int r_f0_offset;
   int r_fsr_offset;
@@ -206,20 +206,20 @@ extern void sparc_collect_rwindow (const struct regcache *regcache,
 				   CORE_ADDR sp, int regnum);
 
 /* Register offsets for SunOS 4.  */
-extern const struct sparc_gregset sparc32_sunos4_gregset;
-extern const struct sparc_fpregset sparc32_sunos4_fpregset;
-extern const struct sparc_fpregset sparc32_bsd_fpregset;
+extern const struct sparc_gregmap sparc32_sunos4_gregmap;
+extern const struct sparc_fpregmap sparc32_sunos4_fpregmap;
+extern const struct sparc_fpregmap sparc32_bsd_fpregmap;
 
-extern void sparc32_supply_gregset (const struct sparc_gregset *gregset,
+extern void sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
 				    struct regcache *regcache,
 				    int regnum, const void *gregs);
-extern void sparc32_collect_gregset (const struct sparc_gregset *gregset,
+extern void sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
 				     const struct regcache *regcache,
 				     int regnum, void *gregs);
-extern void sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
+extern void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 				     struct regcache *regcache,
 				     int regnum, const void *fpregs);
-extern void sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
+extern void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 				      const struct regcache *regcache,
 				      int regnum, void *fpregs);
 
@@ -228,8 +228,8 @@ extern int sparc_is_annulled_branch_insn (CORE_ADDR pc);
 /* Functions and variables exported from sparc-sol2-tdep.c.  */
 
 /* Register offsets for Solaris 2.  */
-extern const struct sparc_gregset sparc32_sol2_gregset;
-extern const struct sparc_fpregset sparc32_sol2_fpregset;
+extern const struct sparc_gregmap sparc32_sol2_gregmap;
+extern const struct sparc_fpregmap sparc32_sol2_fpregmap;
 
 extern int sparc_sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name);
 
@@ -241,7 +241,7 @@ extern void sparc32_sol2_init_abi (struct gdbarch_info info,
 /* Functions and variables exported from sparcnbsd-tdep.c.  */
 
 /* Register offsets for NetBSD.  */
-extern const struct sparc_gregset sparc32nbsd_gregset;
+extern const struct sparc_gregmap sparc32nbsd_gregmap;
 
 /* Return the address of a system call's alternative return
    address.  */
diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c
index 80411dc..14db54f 100644
--- a/gdb/sparc64-linux-nat.c
+++ b/gdb/sparc64-linux-nat.c
@@ -30,7 +30,7 @@
 #include "target.h"
 #include "linux-nat.h"
 
-static const struct sparc_gregset sparc64_linux_ptrace_gregset =
+static const struct sparc_gregmap sparc64_linux_ptrace_gregmap =
 {
   16 * 8,			/* "tstate" */
   17 * 8,			/* %pc */
@@ -47,26 +47,26 @@ static const struct sparc_gregset sparc64_linux_ptrace_gregset =
 void
 supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
 {
-  sparc64_supply_gregset (sparc_gregset, regcache, -1, gregs);
+  sparc64_supply_gregset (sparc_gregmap, regcache, -1, gregs);
 }
 
 void
 supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
 {
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, -1, fpregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, -1, fpregs);
 }
 
 void
 fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
 {
-  sparc64_collect_gregset (sparc_gregset, regcache, regnum, gregs);
+  sparc64_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
 }
 
 void
 fill_fpregset (const struct regcache *regcache,
 	       prfpregset_t *fpregs, int regnum)
 {
-  sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
@@ -80,7 +80,7 @@ _initialize_sparc64_linux_nat (void)
   /* Fill in the generic GNU/Linux methods.  */
   t = linux_target ();
 
-  sparc_fpregset = &sparc64_bsd_fpregset;
+  sparc_fpregmap = &sparc64_bsd_fpregmap;
 
   /* Add our register access methods.  */
   t->to_fetch_registers = sparc_fetch_inferior_registers;
@@ -89,5 +89,5 @@ _initialize_sparc64_linux_nat (void)
   /* Register the target.  */
   linux_nat_add_target (t);
 
-  sparc_gregset = &sparc64_linux_ptrace_gregset;
+  sparc_gregmap = &sparc64_linux_ptrace_gregmap;
 }
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index a381d2a..6040526 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -139,7 +139,7 @@ sparc64_linux_step_trap (struct frame_info *frame, unsigned long insn)
 }
 \f
 
-const struct sparc_gregset sparc64_linux_core_gregset =
+const struct sparc_gregmap sparc64_linux_core_gregmap =
 {
   32 * 8,			/* %tstate */
   33 * 8,			/* %tpc */
@@ -158,7 +158,7 @@ sparc64_linux_supply_core_gregset (const struct regset *regset,
 				   struct regcache *regcache,
 				   int regnum, const void *gregs, size_t len)
 {
-  sparc64_supply_gregset (&sparc64_linux_core_gregset,
+  sparc64_supply_gregset (&sparc64_linux_core_gregmap,
 			  regcache, regnum, gregs);
 }
 
@@ -167,7 +167,7 @@ sparc64_linux_collect_core_gregset (const struct regset *regset,
 				    const struct regcache *regcache,
 				    int regnum, void *gregs, size_t len)
 {
-  sparc64_collect_gregset (&sparc64_linux_core_gregset,
+  sparc64_collect_gregset (&sparc64_linux_core_gregmap,
 			   regcache, regnum, gregs);
 }
 
@@ -176,7 +176,7 @@ sparc64_linux_supply_core_fpregset (const struct regset *regset,
 				    struct regcache *regcache,
 				    int regnum, const void *fpregs, size_t len)
 {
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 static void
@@ -184,7 +184,7 @@ sparc64_linux_collect_core_fpregset (const struct regset *regset,
 				     const struct regcache *regcache,
 				     int regnum, void *fpregs, size_t len)
 {
-  sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 /* Set the program counter for process PTID to PC.  */
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index 2c30261..507838a 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -33,7 +33,7 @@
 #include "solib-svr4.h"
 
 /* From <sys/regset.h>.  */
-const struct sparc_gregset sparc64_sol2_gregset =
+const struct sparc_gregmap sparc64_sol2_gregmap =
 {
   32 * 8,			/* "tstate" */
   33 * 8,			/* %pc */
@@ -46,7 +46,7 @@ const struct sparc_gregset sparc64_sol2_gregset =
   8				/* sizeof (%y) */
 };
 
-const struct sparc_fpregset sparc64_sol2_fpregset =
+const struct sparc_fpregmap sparc64_sol2_fpregmap =
 {
   0 * 8,			/* %f0 */
   33 * 8,			/* %fsr */
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 5d32560..40931d6 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1240,7 +1240,7 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 #define PSR_XCC		0x000f0000
 
 void
-sparc64_supply_gregset (const struct sparc_gregset *gregset,
+sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
 			struct regcache *regcache,
 			int regnum, const void *gregs)
 {
@@ -1255,7 +1255,7 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
     {
       if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
 	{
-	  int offset = gregset->r_tstate_offset;
+	  int offset = gregmap->r_tstate_offset;
 	  ULONGEST tstate, psr;
 	  gdb_byte buf[4];
 
@@ -1268,15 +1268,15 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
 
       if (regnum == SPARC32_PC_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC32_PC_REGNUM,
-			     regs + gregset->r_pc_offset + 4);
+			     regs + gregmap->r_pc_offset + 4);
 
       if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC32_NPC_REGNUM,
-			     regs + gregset->r_npc_offset + 4);
+			     regs + gregmap->r_npc_offset + 4);
 
       if (regnum == SPARC32_Y_REGNUM || regnum == -1)
 	{
-	  int offset = gregset->r_y_offset + 8 - gregset->r_y_size;
+	  int offset = gregmap->r_y_offset + 8 - gregmap->r_y_size;
 	  regcache_raw_supply (regcache, SPARC32_Y_REGNUM, regs + offset);
 	}
     }
@@ -1284,30 +1284,30 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
     {
       if (regnum == SPARC64_STATE_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC64_STATE_REGNUM,
-			     regs + gregset->r_tstate_offset);
+			     regs + gregmap->r_tstate_offset);
 
       if (regnum == SPARC64_PC_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC64_PC_REGNUM,
-			     regs + gregset->r_pc_offset);
+			     regs + gregmap->r_pc_offset);
 
       if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC64_NPC_REGNUM,
-			     regs + gregset->r_npc_offset);
+			     regs + gregmap->r_npc_offset);
 
       if (regnum == SPARC64_Y_REGNUM || regnum == -1)
 	{
 	  gdb_byte buf[8];
 
 	  memset (buf, 0, 8);
-	  memcpy (buf + 8 - gregset->r_y_size,
-		  regs + gregset->r_y_offset, gregset->r_y_size);
+	  memcpy (buf + 8 - gregmap->r_y_size,
+		  regs + gregmap->r_y_offset, gregmap->r_y_size);
 	  regcache_raw_supply (regcache, SPARC64_Y_REGNUM, buf);
 	}
 
       if ((regnum == SPARC64_FPRS_REGNUM || regnum == -1)
-	  && gregset->r_fprs_offset != -1)
+	  && gregmap->r_fprs_offset != -1)
 	regcache_raw_supply (regcache, SPARC64_FPRS_REGNUM,
-			     regs + gregset->r_fprs_offset);
+			     regs + gregmap->r_fprs_offset);
     }
 
   if (regnum == SPARC_G0_REGNUM || regnum == -1)
@@ -1315,7 +1315,7 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
 
   if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
     {
-      int offset = gregset->r_g1_offset;
+      int offset = gregmap->r_g1_offset;
 
       if (sparc32)
 	offset += 4;
@@ -1332,7 +1332,7 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
     {
       /* Not all of the register set variants include Locals and
          Inputs.  For those that don't, we read them off the stack.  */
-      if (gregset->r_l0_offset == -1)
+      if (gregmap->r_l0_offset == -1)
 	{
 	  ULONGEST sp;
 
@@ -1341,7 +1341,7 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
 	}
       else
 	{
-	  int offset = gregset->r_l0_offset;
+	  int offset = gregmap->r_l0_offset;
 
 	  if (sparc32)
 	    offset += 4;
@@ -1357,7 +1357,7 @@ sparc64_supply_gregset (const struct sparc_gregset *gregset,
 }
 
 void
-sparc64_collect_gregset (const struct sparc_gregset *gregset,
+sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
 			 const struct regcache *regcache,
 			 int regnum, void *gregs)
 {
@@ -1371,7 +1371,7 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
     {
       if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
 	{
-	  int offset = gregset->r_tstate_offset;
+	  int offset = gregmap->r_tstate_offset;
 	  ULONGEST tstate, psr;
 	  gdb_byte buf[8];
 
@@ -1387,15 +1387,15 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
 
       if (regnum == SPARC32_PC_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC32_PC_REGNUM,
-			      regs + gregset->r_pc_offset + 4);
+			      regs + gregmap->r_pc_offset + 4);
 
       if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC32_NPC_REGNUM,
-			      regs + gregset->r_npc_offset + 4);
+			      regs + gregmap->r_npc_offset + 4);
 
       if (regnum == SPARC32_Y_REGNUM || regnum == -1)
 	{
-	  int offset = gregset->r_y_offset + 8 - gregset->r_y_size;
+	  int offset = gregmap->r_y_offset + 8 - gregmap->r_y_size;
 	  regcache_raw_collect (regcache, SPARC32_Y_REGNUM, regs + offset);
 	}
     }
@@ -1403,35 +1403,35 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
     {
       if (regnum == SPARC64_STATE_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC64_STATE_REGNUM,
-			      regs + gregset->r_tstate_offset);
+			      regs + gregmap->r_tstate_offset);
 
       if (regnum == SPARC64_PC_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC64_PC_REGNUM,
-			      regs + gregset->r_pc_offset);
+			      regs + gregmap->r_pc_offset);
 
       if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC64_NPC_REGNUM,
-			      regs + gregset->r_npc_offset);
+			      regs + gregmap->r_npc_offset);
 
       if (regnum == SPARC64_Y_REGNUM || regnum == -1)
 	{
 	  gdb_byte buf[8];
 
 	  regcache_raw_collect (regcache, SPARC64_Y_REGNUM, buf);
-	  memcpy (regs + gregset->r_y_offset,
-		  buf + 8 - gregset->r_y_size, gregset->r_y_size);
+	  memcpy (regs + gregmap->r_y_offset,
+		  buf + 8 - gregmap->r_y_size, gregmap->r_y_size);
 	}
 
       if ((regnum == SPARC64_FPRS_REGNUM || regnum == -1)
-	  && gregset->r_fprs_offset != -1)
+	  && gregmap->r_fprs_offset != -1)
 	regcache_raw_collect (regcache, SPARC64_FPRS_REGNUM,
-			      regs + gregset->r_fprs_offset);
+			      regs + gregmap->r_fprs_offset);
 
     }
 
   if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
     {
-      int offset = gregset->r_g1_offset;
+      int offset = gregmap->r_g1_offset;
 
       if (sparc32)
 	offset += 4;
@@ -1449,9 +1449,9 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
     {
       /* Not all of the register set variants include Locals and
          Inputs.  For those that don't, we read them off the stack.  */
-      if (gregset->r_l0_offset != -1)
+      if (gregmap->r_l0_offset != -1)
 	{
-	  int offset = gregset->r_l0_offset;
+	  int offset = gregmap->r_l0_offset;
 
 	  if (sparc32)
 	    offset += 4;
@@ -1467,7 +1467,7 @@ sparc64_collect_gregset (const struct sparc_gregset *gregset,
 }
 
 void
-sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
+sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 			 struct regcache *regcache,
 			 int regnum, const void *fpregs)
 {
@@ -1479,14 +1479,14 @@ sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
 	regcache_raw_supply (regcache, SPARC_F0_REGNUM + i,
-			     regs + fpregset->r_f0_offset + (i * 4));
+			     regs + fpregmap->r_f0_offset + (i * 4));
     }
 
   if (sparc32)
     {
       if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
-			     regs + fpregset->r_fsr_offset);
+			     regs + fpregmap->r_fsr_offset);
     }
   else
     {
@@ -1494,18 +1494,18 @@ sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
 	{
 	  if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
 	    regcache_raw_supply (regcache, SPARC64_F32_REGNUM + i,
-				 (regs + fpregset->r_f0_offset
+				 (regs + fpregmap->r_f0_offset
 				  + (32 * 4) + (i * 8)));
 	}
 
       if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
 	regcache_raw_supply (regcache, SPARC64_FSR_REGNUM,
-			     regs + fpregset->r_fsr_offset);
+			     regs + fpregmap->r_fsr_offset);
     }
 }
 
 void
-sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
+sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 			  const struct regcache *regcache,
 			  int regnum, void *fpregs)
 {
@@ -1517,14 +1517,14 @@ sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
 	regcache_raw_collect (regcache, SPARC_F0_REGNUM + i,
-			      regs + fpregset->r_f0_offset + (i * 4));
+			      regs + fpregmap->r_f0_offset + (i * 4));
     }
 
   if (sparc32)
     {
       if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
-			      regs + fpregset->r_fsr_offset);
+			      regs + fpregmap->r_fsr_offset);
     }
   else
     {
@@ -1532,17 +1532,17 @@ sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
 	{
 	  if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
 	    regcache_raw_collect (regcache, SPARC64_F32_REGNUM + i,
-				  (regs + fpregset->r_f0_offset
+				  (regs + fpregmap->r_f0_offset
 				   + (32 * 4) + (i * 8)));
 	}
 
       if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
 	regcache_raw_collect (regcache, SPARC64_FSR_REGNUM,
-			      regs + fpregset->r_fsr_offset);
+			      regs + fpregmap->r_fsr_offset);
     }
 }
 
-const struct sparc_fpregset sparc64_bsd_fpregset =
+const struct sparc_fpregmap sparc64_bsd_fpregmap =
 {
   0 * 8,			/* %f0 */
   32 * 8,			/* %fsr */
diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h
index 4b69c0d..3cb7e97 100644
--- a/gdb/sparc64-tdep.h
+++ b/gdb/sparc64-tdep.h
@@ -23,7 +23,7 @@
 struct frame_info;
 struct gdbarch;
 struct regcache;
-struct sparc_gregset;
+struct sparc_gregmap;
 struct trad_frame_saved_reg;
 
 #include "sparc-tdep.h"
@@ -97,24 +97,24 @@ enum sparc64_regnum
 extern void sparc64_init_abi (struct gdbarch_info info,
 			      struct gdbarch *gdbarch);
 
-extern void sparc64_supply_gregset (const struct sparc_gregset *gregset,
+extern void sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
 				    struct regcache *regcache,
 				    int regnum, const void *gregs);
-extern void sparc64_collect_gregset (const struct sparc_gregset *gregset,
+extern void sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
 				     const struct regcache *regcache,
 				     int regnum, void *gregs);
-extern void sparc64_supply_fpregset (const struct sparc_fpregset *fpregset,
+extern void sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 				     struct regcache *regcache,
 				     int regnum, const void *fpregs);
-extern void sparc64_collect_fpregset (const struct sparc_fpregset *fpregset,
+extern void sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 				      const struct regcache *regcache,
 				      int regnum, void *fpregs);
 
 /* Functions and variables exported from sparc64-sol2-tdep.c.  */
 
 /* Register offsets for Solaris 2.  */
-extern const struct sparc_gregset sparc64_sol2_gregset;
-extern const struct sparc_fpregset sparc64_sol2_fpregset;
+extern const struct sparc_gregmap sparc64_sol2_gregmap;
+extern const struct sparc_fpregmap sparc64_sol2_fpregmap;
 
 extern void sparc64_sol2_init_abi (struct gdbarch_info info,
 				   struct gdbarch *gdbarch);
@@ -122,17 +122,17 @@ extern void sparc64_sol2_init_abi (struct gdbarch_info info,
 /* Variables exported from sparc64fbsd-tdep.c.  */
 
 /* Register offsets for FreeBSD/sparc64.  */
-extern const struct sparc_gregset sparc64fbsd_gregset;
+extern const struct sparc_gregmap sparc64fbsd_gregmap;
 
 /* Functions and variables exported from sparc64nbsd-tdep.c.  */
 
 /* Register offsets for NetBSD/sparc64.  */
-extern const struct sparc_gregset sparc64nbsd_gregset;
+extern const struct sparc_gregmap sparc64nbsd_gregmap;
 
 extern struct trad_frame_saved_reg *
   sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
 				     struct frame_info *next_frame);
 
-extern const struct sparc_fpregset sparc64_bsd_fpregset;
+extern const struct sparc_fpregmap sparc64_bsd_fpregmap;
 
 #endif /* sparc64-tdep.h */
diff --git a/gdb/sparc64fbsd-nat.c b/gdb/sparc64fbsd-nat.c
index 7c772d4..59a2004 100644
--- a/gdb/sparc64fbsd-nat.c
+++ b/gdb/sparc64fbsd-nat.c
@@ -75,7 +75,7 @@ _initialize_sparc64fbsd_nat (void)
   t->to_make_corefile_notes = fbsd_make_corefile_notes;
   add_target (t);
 
-  sparc_gregset = &sparc64fbsd_gregset;
+  sparc_gregmap = &sparc64fbsd_gregmap;
 
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c
index 96bf390..6ca87dc 100644
--- a/gdb/sparc64fbsd-tdep.c
+++ b/gdb/sparc64fbsd-tdep.c
@@ -34,7 +34,7 @@
 #include "solib-svr4.h"
 
 /* From <machine/reg.h>.  */
-const struct sparc_gregset sparc64fbsd_gregset =
+const struct sparc_gregmap sparc64fbsd_gregmap =
 {
   26 * 8,			/* "tstate" */
   25 * 8,			/* %pc */
@@ -53,7 +53,7 @@ sparc64fbsd_supply_gregset (const struct regset *regset,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs, size_t len)
 {
-  sparc64_supply_gregset (&sparc64fbsd_gregset, regcache, regnum, gregs);
+  sparc64_supply_gregset (&sparc64fbsd_gregmap, regcache, regnum, gregs);
 }
 
 static void
@@ -61,7 +61,7 @@ sparc64fbsd_collect_gregset (const struct regset *regset,
 			     const struct regcache *regcache,
 			     int regnum, void *gregs, size_t len)
 {
-  sparc64_collect_gregset (&sparc64fbsd_gregset, regcache, regnum, gregs);
+  sparc64_collect_gregset (&sparc64fbsd_gregmap, regcache, regnum, gregs);
 }
 
 static void
@@ -69,7 +69,7 @@ sparc64fbsd_supply_fpregset (const struct regset *regset,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs, size_t len)
 {
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 static void
@@ -77,7 +77,7 @@ sparc64fbsd_collect_fpregset (const struct regset *regset,
 			      const struct regcache *regcache,
 			      int regnum, void *fpregs, size_t len)
 {
-  sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 \f
 
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
index f8db7fa..bfcf74a 100644
--- a/gdb/sparc64nbsd-nat.c
+++ b/gdb/sparc64nbsd-nat.c
@@ -30,55 +30,55 @@
    traced process is 32-bit or 64-bit.  */
 
 static void
-sparc64nbsd_supply_gregset (const struct sparc_gregset *gregset,
+sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs)
 {
   int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
 
   if (sparc32)
-    sparc32_supply_gregset (&sparc32nbsd_gregset, regcache, regnum, gregs);
+    sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
   else
-    sparc64_supply_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs);
+    sparc64_supply_gregset (&sparc64nbsd_gregmap, regcache, regnum, gregs);
 }
 
 static void
-sparc64nbsd_collect_gregset (const struct sparc_gregset *gregset,
+sparc64nbsd_collect_gregset (const struct sparc_gregmap *gregmap,
 			     const struct regcache *regcache,
 			     int regnum, void *gregs)
 {
   int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
 
   if (sparc32)
-    sparc32_collect_gregset (&sparc32nbsd_gregset, regcache, regnum, gregs);
+    sparc32_collect_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
   else
-    sparc64_collect_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs);
+    sparc64_collect_gregset (&sparc64nbsd_gregmap, regcache, regnum, gregs);
 }
 
 static void
-sparc64nbsd_supply_fpregset (const struct sparc_fpregset *fpregset,
+sparc64nbsd_supply_fpregset (const struct sparc_fpregmap *fpregmap,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs)
 {
   int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
 
   if (sparc32)
-    sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
+    sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
   else
-    sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+    sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 static void
-sparc64nbsd_collect_fpregset (const struct sparc_fpregset *fpregset,
+sparc64nbsd_collect_fpregset (const struct sparc_fpregmap *fpregmap,
 			      const struct regcache *regcache,
 			      int regnum, void *fpregs)
 {
   int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
 
   if (sparc32)
-    sparc32_collect_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
+    sparc32_collect_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
   else
-    sparc64_collect_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+    sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 /* Determine whether `gregset_t' contains register REGNUM.  */
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index 744a5f2..fac4c27 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -37,7 +37,7 @@
 #include "nbsd-tdep.h"
 
 /* From <machine/reg.h>.  */
-const struct sparc_gregset sparc64nbsd_gregset =
+const struct sparc_gregmap sparc64nbsd_gregmap =
 {
   0 * 8,			/* "tstate" */
   1 * 8,			/* %pc */
@@ -56,7 +56,7 @@ sparc64nbsd_supply_gregset (const struct regset *regset,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs, size_t len)
 {
-  sparc64_supply_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs);
+  sparc64_supply_gregset (&sparc64nbsd_gregmap, regcache, regnum, gregs);
 }
 
 static void
@@ -64,7 +64,7 @@ sparc64nbsd_supply_fpregset (const struct regset *regset,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs, size_t len)
 {
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 \f
 
diff --git a/gdb/sparc64obsd-nat.c b/gdb/sparc64obsd-nat.c
index a6cf8b3..8b5423c 100644
--- a/gdb/sparc64obsd-nat.c
+++ b/gdb/sparc64obsd-nat.c
@@ -120,8 +120,8 @@ _initialize_sparc64obsd_nat (void)
   sparc_gregset_supplies_p = sparc64obsd_gregset_supplies_p;
   sparc_fpregset_supplies_p = sparc64obsd_fpregset_supplies_p;
 
-  sparc_gregset = &sparc64nbsd_gregset;
-  sparc_fpregset = &sparc64_bsd_fpregset;
+  sparc_gregmap = &sparc64nbsd_gregmap;
+  sparc_fpregmap = &sparc64_bsd_fpregmap;
 
   /* Add some extra features to the generic SPARC target.  */
   obsd_add_target (sparc_target ());
diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c
index e2dce3b..8f94574 100644
--- a/gdb/sparc64obsd-tdep.c
+++ b/gdb/sparc64obsd-tdep.c
@@ -46,7 +46,7 @@
    match the ptrace(2) layout.  */
 
 /* From <machine/reg.h>.  */
-const struct sparc_gregset sparc64obsd_gregset =
+const struct sparc_gregmap sparc64obsd_gregmap =
 {
   0 * 8,			/* "tstate" */
   1 * 8,			/* %pc */
@@ -59,7 +59,7 @@ const struct sparc_gregset sparc64obsd_gregset =
   4				/* sizeof (%y) */
 };
 
-const struct sparc_gregset sparc64obsd_core_gregset =
+const struct sparc_gregmap sparc64obsd_core_gregmap =
 {
   0 * 8,			/* "tstate" */
   1 * 8,			/* %pc */
@@ -81,12 +81,12 @@ sparc64obsd_supply_gregset (const struct regset *regset,
 
   if (len < 832)
     {
-      sparc64_supply_gregset (&sparc64obsd_gregset, regcache, regnum, gregs);
+      sparc64_supply_gregset (&sparc64obsd_gregmap, regcache, regnum, gregs);
       return;
     }
 
-  sparc64_supply_gregset (&sparc64obsd_core_gregset, regcache, regnum, gregs);
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_supply_gregset (&sparc64obsd_core_gregmap, regcache, regnum, gregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 static void
@@ -94,7 +94,7 @@ sparc64obsd_supply_fpregset (const struct regset *regset,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs, size_t len)
 {
-  sparc64_supply_fpregset (&sparc64_bsd_fpregset, regcache, regnum, fpregs);
+  sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
 }
 \f
 
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c
index c7eb118..0393e34 100644
--- a/gdb/sparcnbsd-nat.c
+++ b/gdb/sparcnbsd-nat.c
@@ -62,8 +62,8 @@ void _initialize_sparcnbsd_nat (void);
 void
 _initialize_sparcnbsd_nat (void)
 {
-  sparc_gregset = &sparc32nbsd_gregset;
-  sparc_fpregset = &sparc32_bsd_fpregset;
+  sparc_gregmap = &sparc32nbsd_gregmap;
+  sparc_fpregmap = &sparc32_bsd_fpregmap;
 
   /* We've got nothing to add to the generic SPARC target.  */
   add_target (sparc_target ());
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index 14fbed9..ac94f10 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -41,7 +41,7 @@
 #define X_RS2(i) ((i) & 0x1f)
 #define X_I(i) (((i) >> 13) & 1)
 
-const struct sparc_gregset sparc32nbsd_gregset =
+const struct sparc_gregmap sparc32nbsd_gregmap =
 {
   0 * 4,			/* %psr */
   1 * 4,			/* %pc */
@@ -58,13 +58,13 @@ sparc32nbsd_supply_gregset (const struct regset *regset,
 			    struct regcache *regcache,
 			    int regnum, const void *gregs, size_t len)
 {
-  sparc32_supply_gregset (&sparc32nbsd_gregset, regcache, regnum, gregs);
+  sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
 
   /* Traditional NetBSD core files don't use multiple register sets.
      Instead, the general-purpose and floating-point registers are
      lumped together in a single section.  */
   if (len >= 212)
-    sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum,
+    sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum,
 			     (const char *) gregs + 80);
 }
 
@@ -73,7 +73,7 @@ sparc32nbsd_supply_fpregset (const struct regset *regset,
 			     struct regcache *regcache,
 			     int regnum, const void *fpregs, size_t len)
 {
-  sparc32_supply_fpregset (&sparc32_bsd_fpregset, regcache, regnum, fpregs);
+  sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
 }
 
 \f
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (8 preceding siblings ...)
  2014-04-28  9:51 ` [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap" Andreas Arnez
@ 2014-04-28  9:52 ` Andreas Arnez
  2014-05-05  9:52   ` Mark Kettenis
  2014-04-28  9:53 ` [RFC 11/23] Drop regset_alloc() Andreas Arnez
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Kettenis


gdb/
	* sparc-linux-tdep.c (sparc32_linux_gregset)
	(sparc32_linux_fpregset): New static regset structures.
	(sparc32_linux_init_abi): Drop dynamic regset allocations.
	* sparc-tdep.h (struct gdbarch_tdep): Constify 'gregset' and
	'fpregset' fields.
	* sparc64-linux-tdep.c: (sparc64_linux_gregset)
	(sparc64_linux_fpregset): New static regset structures.
	(sparc64_linux_init_abi): Drop dynamic regset allocations.
	* sparc64fbsd-tdep.c (sparc64fbsd_gregset, sparc64fbsd_fpregset):
	New static regset structures.
	(sparc64fbsd_init_abi): Drop dynamic regset allocations.
	* sparc64nbsd-tdep.c (sparc64nbsd_gregset, sparc64nbsd_fpregset):
	New static regset structures.
	(sparc64nbsd_init_abi): Drop dynamic regset allocations.
	* sparc64obsd-tdep.c (sparc64obsd_gregset, sparc64obsd_fpregset):
	New static regset structures.
	(sparc64obsd_init_abi): Drop dynamic regset allocations.
	* sparcnbsd-tdep.c (sparc32nbsd_gregset, sparc32nbsd_fpregset):
	New static regset structures.
	(sparc32nbsd_init_abi): Drop dynamic regset allocations.
---
 gdb/sparc-linux-tdep.c   | 20 ++++++++++++++++----
 gdb/sparc-tdep.h         |  4 ++--
 gdb/sparc64-linux-tdep.c | 20 ++++++++++++++++----
 gdb/sparc64fbsd-tdep.c   | 16 ++++++++++++----
 gdb/sparc64nbsd-tdep.c   | 14 ++++++++++++--
 gdb/sparc64obsd-tdep.c   | 15 ++++++++++++---
 gdb/sparcnbsd-tdep.c     | 14 ++++++++++++--
 7 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 4a193e2..fd1fc3d 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -403,6 +403,20 @@ sparc32_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
 
 \f
 
+static const struct regset sparc32_linux_gregset =
+  {
+    NULL,
+    sparc32_linux_supply_core_gregset,
+    sparc32_linux_collect_core_gregset
+  };
+
+static const struct regset sparc32_linux_fpregset =
+  {
+    NULL,
+    sparc32_linux_supply_core_fpregset,
+    sparc32_linux_collect_core_fpregset
+  };
+
 static void
 sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -410,12 +424,10 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   linux_init_abi (info, gdbarch);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc32_linux_supply_core_gregset,
-				sparc32_linux_collect_core_gregset);
+  tdep->gregset = &sparc32_linux_gregset;
   tdep->sizeof_gregset = 152;
 
-  tdep->fpregset = regset_alloc (gdbarch, sparc32_linux_supply_core_fpregset,
-				 sparc32_linux_collect_core_fpregset);
+  tdep->fpregset = &sparc32_linux_fpregset;
   tdep->sizeof_fpregset = 396;
 
   tramp_frame_prepend_unwinder (gdbarch, &sparc32_linux_sigframe);
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 12c8ef7..13f0bb2 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -58,9 +58,9 @@ struct gdbarch_tdep
   int npc_regnum;
 
   /* Register sets.  */
-  struct regset *gregset;
+  const struct regset *gregset;
   size_t sizeof_gregset;
-  struct regset *fpregset;
+  const struct regset *fpregset;
   size_t sizeof_fpregset;
 
   /* Offset of saved PC in jmp_buf.  */
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 6040526..e843eb3 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -280,6 +280,20 @@ sparc64_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
 
 \f
 
+static const struct regset sparc64_linux_gregset =
+  {
+    NULL,
+    sparc64_linux_supply_core_gregset,
+    sparc64_linux_collect_core_gregset
+  };
+
+static const struct regset sparc64_linux_fpregset =
+  {
+    NULL,
+    sparc64_linux_supply_core_fpregset,
+    sparc64_linux_collect_core_fpregset
+  };
+
 static void
 sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -287,12 +301,10 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   linux_init_abi (info, gdbarch);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset,
-				sparc64_linux_collect_core_gregset);
+  tdep->gregset = &sparc64_linux_gregset;
   tdep->sizeof_gregset = 288;
 
-  tdep->fpregset = regset_alloc (gdbarch, sparc64_linux_supply_core_fpregset,
-				 sparc64_linux_collect_core_fpregset);
+  tdep->fpregset = &sparc64_linux_fpregset;
   tdep->sizeof_fpregset = 280;
 
   tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe);
diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c
index 6ca87dc..fde7815 100644
--- a/gdb/sparc64fbsd-tdep.c
+++ b/gdb/sparc64fbsd-tdep.c
@@ -209,17 +209,25 @@ static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
 };
 \f
 
+static const struct regset sparc64fbsd_gregset =
+  {
+    NULL, sparc64fbsd_supply_gregset, sparc64fbsd_collect_gregset
+  };
+
+static const struct regset sparc64fbsd_fpregset =
+  {
+    NULL, sparc64fbsd_supply_fpregset, sparc64fbsd_collect_fpregset
+  };
+
 static void
 sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc64fbsd_supply_gregset,
-				sparc64fbsd_collect_gregset);
+  tdep->gregset = &sparc64fbsd_gregset;
   tdep->sizeof_gregset = 256;
 
-  tdep->fpregset = regset_alloc (gdbarch, sparc64fbsd_supply_fpregset,
-				 sparc64fbsd_collect_fpregset);
+  tdep->fpregset = &sparc64fbsd_fpregset;
   tdep->sizeof_fpregset = 272;
 
   frame_unwind_append_unwinder (gdbarch, &sparc64fbsd_sigtramp_frame_unwind);
diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c
index fac4c27..b67c762 100644
--- a/gdb/sparc64nbsd-tdep.c
+++ b/gdb/sparc64nbsd-tdep.c
@@ -237,15 +237,25 @@ static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
 };
 \f
 
+static const struct regset sparc64nbsd_gregset =
+  {
+    NULL, sparc64nbsd_supply_gregset, NULL
+  };
+
+static const struct regset sparc64nbsd_fpregset =
+  {
+    NULL, sparc64nbsd_supply_fpregset, NULL
+  };
+
 static void
 sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc64nbsd_supply_gregset, NULL);
+  tdep->gregset = &sparc64nbsd_gregset;
   tdep->sizeof_gregset = 160;
 
-  tdep->fpregset = regset_alloc (gdbarch, sparc64nbsd_supply_fpregset, NULL);
+  tdep->fpregset =  &sparc64nbsd_fpregset;
   tdep->sizeof_fpregset = 272;
 
   /* Make sure we can single-step "new" syscalls.  */
diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c
index 8f94574..8cc04f7 100644
--- a/gdb/sparc64obsd-tdep.c
+++ b/gdb/sparc64obsd-tdep.c
@@ -403,15 +403,24 @@ sparc64obsd_collect_uthread(const struct regcache *regcache,
 }
 \f
 
+static const struct regset sparc64obsd_gregset =
+  {
+    NULL, sparc64obsd_supply_gregset, NULL
+  };
+
+static const struct regset sparc64obsd_fpregset =
+  {
+    NULL, sparc64obsd_supply_fpregset, NULL
+  };
+
 static void
 sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc64obsd_supply_gregset, NULL);
+  tdep->gregset = &sparc64obsd_gregset;
   tdep->sizeof_gregset = 288;
-
-  tdep->fpregset = regset_alloc (gdbarch, sparc64obsd_supply_fpregset, NULL);
+  tdep->fpregset = &sparc64obsd_fpregset;
   tdep->sizeof_fpregset = 272;
 
   /* Make sure we can single-step "new" syscalls.  */
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index ac94f10..b267842 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -283,6 +283,16 @@ sparcnbsd_step_trap (struct frame_info *frame, unsigned long insn)
 }
 \f
 
+static const struct regset sparc32nbsd_gregset =
+  {
+    NULL, sparc32nbsd_supply_gregset, NULL
+  };
+
+static const struct regset sparc32nbsd_fpregset =
+  {
+    NULL, sparc32nbsd_supply_fpregset, NULL
+  };
+
 static void
 sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -292,10 +302,10 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_long_double_bit (gdbarch, 64);
   set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
-  tdep->gregset = regset_alloc (gdbarch, sparc32nbsd_supply_gregset, NULL);
+  tdep->gregset = &sparc32nbsd_gregset;
   tdep->sizeof_gregset = 20 * 4;
 
-  tdep->fpregset = regset_alloc (gdbarch, sparc32nbsd_supply_fpregset, NULL);
+  tdep->fpregset = &sparc32nbsd_fpregset;
   tdep->sizeof_fpregset = 33 * 4;
 
   /* Make sure we can single-step "new" syscalls.  */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 11/23] Drop regset_alloc()
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (9 preceding siblings ...)
  2014-04-28  9:52 ` [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures Andreas Arnez
@ 2014-04-28  9:53 ` Andreas Arnez
  2014-05-05  9:53   ` Mark Kettenis
  2014-04-28  9:54 ` [RFC 12/23] regcache: Add functions suitable for regset_supply/collect Andreas Arnez
                   ` (13 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:53 UTC (permalink / raw)
  To: gdb-patches

Now that all invocations of regset_alloc() have been removed, the
function is dropped.  Since regset_alloc() was the only function
provided by regset.c, this source file is removed as well.

gdb/
	* Makefile.in (SFILES): Delete "regset.c".
	(COMMON_OBS): Delete "regset.o".
	* regset.c: Remove.
	* regset.h (regset_alloc): Delete prototype.
---
 gdb/Makefile.in |  4 ++--
 gdb/regset.c    | 43 -------------------------------------------
 gdb/regset.h    | 11 -----------
 3 files changed, 2 insertions(+), 56 deletions(-)
 delete mode 100644 gdb/regset.c

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 3efedc8..f2c16ec 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -836,7 +836,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
 	jit.c \
 	xml-syscall.c \
 	annotate.c common/signals.c copying.c dfp.c gdb.c inf-child.c \
-	regset.c sol-thread.c windows-termcap.c \
+	sol-thread.c windows-termcap.c \
 	common/gdb_vecs.c common/common-utils.c common/xml-utils.c \
 	common/ptid.c common/buffer.c gdb-dlfcn.c common/agent.c \
 	common/format.c common/filestuff.c btrace.c record-btrace.c ctf.c \
@@ -1011,7 +1011,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
 	gnu-v2-abi.o gnu-v3-abi.o cp-abi.o cp-support.o \
 	cp-namespace.o \
 	d-support.o \
-	reggroups.o regset.o \
+	reggroups.o \
 	trad-frame.o \
 	tramp-frame.o \
 	solib.o solib-target.o \
diff --git a/gdb/regset.c b/gdb/regset.c
deleted file mode 100644
index 1d19d34..0000000
--- a/gdb/regset.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Manage register sets.
-
-   Copyright (C) 2004-2014 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include "defs.h"
-#include "regset.h"
-
-#include "gdb_assert.h"
-
-/* Allocate a fresh 'struct regset' whose supply_regset function is
-   SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
-   If the regset has no collect_regset function, pass NULL for
-   COLLECT_REGSET.
-
-   The object returned is allocated on ARCH's obstack.  */
-
-struct regset *
-regset_alloc (struct gdbarch *arch,
-              supply_regset_ftype *supply_regset,
-              collect_regset_ftype *collect_regset)
-{
-  struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
-
-  regset->supply_regset = supply_regset;
-  regset->collect_regset = collect_regset;
-
-  return regset;
-}
diff --git a/gdb/regset.h b/gdb/regset.h
index f1a6e24..03dbdaa 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -52,15 +52,4 @@ struct regset
   collect_regset_ftype *collect_regset;
 };
 
-/* Allocate a fresh 'struct regset' whose supply_regset function is
-   SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
-   If the regset has no collect_regset function, pass NULL for
-   COLLECT_REGSET.
-
-   The object returned is allocated on ARCH's obstack.  */
-
-extern struct regset *regset_alloc (struct gdbarch *arch,
-                                    supply_regset_ftype *supply_regset,
-                                    collect_regset_ftype *collect_regset);
-
 #endif /* regset.h */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 12/23] regcache: Add functions suitable for regset_supply/collect.
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (10 preceding siblings ...)
  2014-04-28  9:53 ` [RFC 11/23] Drop regset_alloc() Andreas Arnez
@ 2014-04-28  9:54 ` Andreas Arnez
  2014-05-05 10:02   ` Mark Kettenis
  2014-04-28  9:54 ` [RFC 13/23] S390: Migrate to regcache_supply/collect_regset Andreas Arnez
                   ` (12 subsequent siblings)
  24 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:54 UTC (permalink / raw)
  To: gdb-patches

These functions are intended to suit all targets that don't require too
special logic in their regset supply/collect methods.  Having such
generic functions helps reducing target-specific complexity.

gdb/
	* regcache.c: Include "regset.h".
	(regcache_supply_regset, regcache_collect_regset): New functions.
	* regcache.h (struct regcache_map_entry): New structure.
	(REGCACHE_MAP_SKIP_BYTES): New enum value.
	(regcache_supply_regset, regcache_collect_regset): New prototypes.
---
 gdb/regcache.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/regcache.h | 38 +++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)

diff --git a/gdb/regcache.c b/gdb/regcache.c
index 8b588c6..b38031e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -30,6 +30,7 @@
 #include "exceptions.h"
 #include "remote.h"
 #include "valprint.h"
+#include "regset.h"
 
 /*
  * DATA STRUCTURE
@@ -1031,6 +1032,71 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
   memcpy (buf, regbuf, size);
 }
 
+/* Supply register REGNUM from BUF to REGCACHE, using the register map
+   in REGSET.  If REGNUM is -1, do this for all registers in
+   REGSET.  */
+
+void
+regcache_supply_regset (const struct regset *regset,
+			struct regcache *regcache,
+			int regnum, const void *buf, size_t size)
+{
+  const struct regcache_map_entry *map = regset->descr;
+  int offs = 0;
+  int i, count;
+
+  for (i = 0; (count = map[i].count) != 0; i++)
+    {
+      int regno = map[i].regno;
+
+      if (regno == REGCACHE_MAP_SKIP_BYTES)
+	offs += count;
+      else
+	for (; count--; regno++)
+	  {
+	    int new_offs = offs + regcache->descr->sizeof_register[regno];
+
+	    if (new_offs <= size && (regnum == -1 || regnum == regno))
+	      regcache_raw_supply (regcache, regno,
+				   buf ? (const gdb_byte *) buf + offs
+				   : NULL);
+	    offs = new_offs;
+	  }
+    }
+}
+
+/* Collect register REGNUM from REGCACHE to BUF, using the register
+   map in REGSET.  If REGNUM is -1, do this for all registers in
+   REGSET.  */
+
+void
+regcache_collect_regset (const struct regset *regset,
+			 const struct regcache *regcache,
+			 int regnum, void *buf, size_t size)
+{
+  const struct regcache_map_entry *map = regset->descr;
+  int offs = 0;
+  int i, count;
+
+  for (i = 0; (count = map[i].count) != 0; i++)
+    {
+      int regno = map[i].regno;
+
+      if (regno == REGCACHE_MAP_SKIP_BYTES)
+	offs += count;
+      else
+	for (; count--; regno++)
+	  {
+	    int new_offs = offs + regcache->descr->sizeof_register[regno];
+
+	    if (new_offs <= size && (regnum == -1 || regnum == regno))
+	      regcache_raw_collect (regcache, regno,
+				    (gdb_byte *) buf + offs);
+	    offs = new_offs;
+	  }
+    }
+}
+
 
 /* Special handling for register PC.  */
 
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 8423f57..cc2bda8 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -147,6 +147,44 @@ extern void regcache_raw_supply (struct regcache *regcache,
 extern void regcache_raw_collect (const struct regcache *regcache,
 				  int regnum, void *buf);
 
+/* Mapping between register numbers and offsets in a buffer, for use
+   in the '*regset' functions below.  The first entry in a map refers
+   to offset 0, and each entry increases the offset by its size.
+   Specifying count=N and regno=R is equivalent to N consecutive
+   entries with count=1 and with regno ranging from R to R+N-1.  The
+   end of the map is marked with a dummy entry having count=0.  */
+
+struct regcache_map_entry
+{
+  int count;
+  int regno;
+};
+
+/* Special value for the 'regno' field in the struct above.  */
+
+enum
+  {
+    REGCACHE_MAP_SKIP_BYTES = -1,
+  };
+
+/* Transfer a set of registers (as described by REGSET) between
+   REGCACHE and BUF.  If REGNUM == -1, transfer all registers
+   belonging to the regset, otherwise just the register numbered
+   REGNUM.  The REGSET's 'descr' field must point to an array of
+   'struct regcache_map_entry'.
+
+   These functions are suitable for the 'regset_supply' and
+   'regset_collect' fields in a regset structure.
+  */
+
+extern void regcache_supply_regset (const struct regset *regset,
+				    struct regcache *regcache,
+				    int regnum, const void *buf,
+				    size_t size);
+extern void regcache_collect_regset (const struct regset *regset,
+				     const struct regcache *regcache,
+				     int regnum, void *buf, size_t size);
+
 
 /* The type of a register.  This function is slightly more efficient
    then its gdbarch vector counterpart since it returns a precomputed
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 13/23] S390: Migrate to regcache_supply/collect_regset
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (11 preceding siblings ...)
  2014-04-28  9:54 ` [RFC 12/23] regcache: Add functions suitable for regset_supply/collect Andreas Arnez
@ 2014-04-28  9:54 ` Andreas Arnez
  2014-04-28  9:55 ` [RFC 14/23] AARCH64 Linux: Fill 'collect_regset' in regset structures Andreas Arnez
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand

Rather than supplying own supply/collect functions, use the generic
functions regcache_supply_regset and regcache_collect_regset instead.
The register maps are rewritten accordingly and become much shorter
(and better readable) than before.

gdb/
	* s390-linux-nat.c: Include "regset.h".
	(regmap_gregset): Delete macro.
	(s390_64_regmap_gregset): New register map for
	regcache_supply/_collect_regset.
	(s390_64_gregset): New regset.
	(S390_PSWM_OFFSET, S390_PSWA_OFFSET): New macros.
	(regmap_fpregset): Delete macro.
	(s390_native_supply, s390_native_collect): Delete functions.
	(supply_gregset, fill_gregset): Replace s390-specific regmap
	handling by a call to regcache_supply/_collect_regset.
	(supply_fpregset, fill_fpregset): Call regcache_supply/
	_collect_regset instead of s390_native_supply/_collect.
	(fetch_regset, store_regset): Likewise.  Also change the last
	parameter to a regset instead of a regmap.
	(s390_linux_fetch_inferior_registers)
	(390_linux_store_inferior_registers): Adjust last parameter in
	calls to fetch_regset and store_regset.
	* s390-linux-tdep.c (s390_regmap_gregset): Rename to...
	(s390_gregmap): ... this.  Also make static const and convert to
	regcache_map_entry format.
	(s390x_regmap_gregset): Delete.
	(s390_regmap_fpregset): Rename to...
	(s390_fpregmap): ... this.  Make static const and convert to
	regcache_map_entry format.
	(s390_regmap_upper, s390_regmap_last_break)
	(s390x_regmap_last_break, s390_regmap_system_call)
	(s390_regmap_tdb): Likewise.
	(s390_supply_regset, s390_collect_regset): Remove functions.
	(s390_supply_tdb_regset): Call regcache_supply_regset instead of
	s390_supply_regset.
	(s390_gregset, s390_fpregset, s390_upper_regset)
	(s390_last_break_regset, s390x_last_break_regset)
	(s390_system_call_regset, s390_tdb_regset): Make global and
	replace s390_supply/_collect_regset by regcache_supply/
	_collect_regset.
	(s390x_gregset): Delete.
	(s390_gdbarch_init): Replace s390x_gregset by s390_gregset.
	* s390-linux-tdep.h (s390_regmap_gregset, s390x_regmap_gregset)
	(s390_regmap_fpregset, s390_regmap_last_break)
	(s390x_regmap_last_break, s390_regmap_system_call)
	(s390_regmap_tdb): Delete global variable declarations.
	(s390_gregset, s390_fpregset, s390_last_break_regset)
	(s390x_last_break_regset, s390_system_call_regset)
	(s390_tdb_regset): New global variable declarations.
---
 gdb/s390-linux-nat.c  | 177 ++++++++++++++------------------
 gdb/s390-linux-tdep.c | 278 +++++++++++---------------------------------------
 gdb/s390-linux-tdep.h |  13 ++-
 3 files changed, 140 insertions(+), 328 deletions(-)

diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 5c38952..8d8cf59 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -26,6 +26,7 @@
 #include "linux-nat.h"
 #include "auxv.h"
 #include "gregset.h"
+#include "regset.h"
 
 #include "s390-linux-tdep.h"
 #include "elf/common.h"
@@ -49,42 +50,46 @@ static int have_regset_last_break = 0;
 static int have_regset_system_call = 0;
 static int have_regset_tdb = 0;
 
-/* Map registers to gregset/ptrace offsets.
-   These arrays are defined in s390-tdep.c.  */
+/* Register map for 32-bit executables running under a 64-bit
+   kernel.  */
 
 #ifdef __s390x__
-#define regmap_gregset s390x_regmap_gregset
-#else
-#define regmap_gregset s390_regmap_gregset
+static const struct regcache_map_entry s390_64_regmap_gregset[] =
+  {
+    /* Skip PSWM and PSWA, since they must be handled specially.  */
+    { 16, REGCACHE_MAP_SKIP_BYTES },
+    { 1, S390_R0_UPPER_REGNUM }, { 1, S390_R0_REGNUM },
+    { 1, S390_R1_UPPER_REGNUM }, { 1, S390_R1_REGNUM },
+    { 1, S390_R2_UPPER_REGNUM }, { 1, S390_R2_REGNUM },
+    { 1, S390_R3_UPPER_REGNUM }, { 1, S390_R3_REGNUM },
+    { 1, S390_R4_UPPER_REGNUM }, { 1, S390_R4_REGNUM },
+    { 1, S390_R5_UPPER_REGNUM }, { 1, S390_R5_REGNUM },
+    { 1, S390_R6_UPPER_REGNUM }, { 1, S390_R6_REGNUM },
+    { 1, S390_R7_UPPER_REGNUM }, { 1, S390_R7_REGNUM },
+    { 1, S390_R8_UPPER_REGNUM }, { 1, S390_R8_REGNUM },
+    { 1, S390_R9_UPPER_REGNUM }, { 1, S390_R9_REGNUM },
+    { 1, S390_R10_UPPER_REGNUM }, { 1, S390_R10_REGNUM },
+    { 1, S390_R11_UPPER_REGNUM }, { 1, S390_R11_REGNUM },
+    { 1, S390_R12_UPPER_REGNUM }, { 1, S390_R12_REGNUM },
+    { 1, S390_R13_UPPER_REGNUM }, { 1, S390_R13_REGNUM },
+    { 1, S390_R14_UPPER_REGNUM }, { 1, S390_R14_REGNUM },
+    { 1, S390_R15_UPPER_REGNUM }, { 1, S390_R15_REGNUM },
+    { 16, S390_A0_REGNUM },
+    { 4, REGCACHE_MAP_SKIP_BYTES }, { 1, S390_ORIG_R2_REGNUM },
+    { 0 }
+  };
+
+static const struct regset s390_64_gregset =
+  {
+    s390_64_regmap_gregset,
+    regcache_supply_regset,
+    regcache_collect_regset
+  };
+
+#define S390_PSWM_OFFSET 0
+#define S390_PSWA_OFFSET 8
 #endif
 
-#define regmap_fpregset s390_regmap_fpregset
-
-/* Fill the regset described by MAP into REGCACHE, using the values
-   from REGP.  The MAP array represents each register as a pair
-   (offset, regno) of short integers and is terminated with -1. */
-
-static void
-s390_native_supply (struct regcache *regcache, const short *map,
-		    const gdb_byte *regp)
-{
-  for (; map[0] >= 0; map += 2)
-    regcache_raw_supply (regcache, map[1], regp ? regp + map[0] : NULL);
-}
-
-/* Collect the register REGNO out of the regset described by MAP from
-   REGCACHE into REGP.  If REGNO == -1, do this for all registers in
-   this regset. */
-
-static void
-s390_native_collect (const struct regcache *regcache, const short *map,
-		     int regno, gdb_byte *regp)
-{
-  for (; map[0] >= 0; map += 2)
-    if (regno == -1 || regno == map[1])
-      regcache_raw_collect (regcache, map[1], regp + map[0]);
-}
-
 /* Fill GDB's register array with the general-purpose register values
    in *REGP.
 
@@ -100,28 +105,15 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
   if (gdbarch_ptr_bit (gdbarch) == 32)
     {
       enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-      ULONGEST pswm = 0, pswa = 0;
+      ULONGEST pswm, pswa;
       gdb_byte buf[4];
-      const short *map;
-
-      for (map = regmap_gregset; map[0] >= 0; map += 2)
-	{
-	  const gdb_byte *p = (const gdb_byte *) regp + map[0];
-	  int regno = map[1];
-
-	  if (regno == S390_PSWM_REGNUM)
-	    pswm = extract_unsigned_integer (p, 8, byte_order);
-	  else if (regno == S390_PSWA_REGNUM)
-	    pswa = extract_unsigned_integer (p, 8, byte_order);
-	  else
-	    {
-	      if ((regno >= S390_R0_REGNUM && regno <= S390_R15_REGNUM)
-		  || regno == S390_ORIG_R2_REGNUM)
-		p += 4;
-	      regcache_raw_supply (regcache, regno, p);
-	    }
-	}
 
+      regcache_supply_regset (&s390_64_gregset, regcache, -1,
+			      regp, sizeof (gregset_t));
+      pswm = extract_unsigned_integer ((const gdb_byte *) regp
+				       + S390_PSWM_OFFSET, 8, byte_order);
+      pswa = extract_unsigned_integer ((const gdb_byte *) regp
+				       + S390_PSWA_OFFSET, 8, byte_order);
       store_unsigned_integer (buf, 4, byte_order, (pswm >> 32) | 0x80000);
       regcache_raw_supply (regcache, S390_PSWM_REGNUM, buf);
       store_unsigned_integer (buf, 4, byte_order,
@@ -131,7 +123,8 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
     }
 #endif
 
-  s390_native_supply (regcache, regmap_gregset, (const gdb_byte *) regp);
+  regcache_supply_regset (&s390_gregset, regcache, -1, regp,
+			  sizeof (gregset_t));
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
@@ -145,28 +138,8 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   if (gdbarch_ptr_bit (gdbarch) == 32)
     {
-      gdb_byte *psw_p[2];
-      const short *map;
-
-      for (map = regmap_gregset; map[0] >= 0; map += 2)
-	{
-	  gdb_byte *p = (gdb_byte *) regp + map[0];
-	  int reg = map[1];
-
-	  if (reg >= S390_PSWM_REGNUM && reg <= S390_PSWA_REGNUM)
-	    psw_p[reg - S390_PSWM_REGNUM] = p;
-
-	  else if (regno == -1 || regno == reg)
-	    {
-	      if ((reg >= S390_R0_REGNUM && reg <= S390_R15_REGNUM)
-		  || reg == S390_ORIG_R2_REGNUM)
-		{
-		  memset (p, 0, 4);
-		  p += 4;
-		}
-	      regcache_raw_collect (regcache, reg, p + 4);
-	    }
-	}
+      regcache_collect_regset (&s390_64_gregset, regcache, regno,
+			       regp, sizeof (gregset_t));
 
       if (regno == -1
 	  || regno == S390_PSWM_REGNUM || regno == S390_PSWA_REGNUM)
@@ -181,18 +154,19 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
 	  pswa = extract_unsigned_integer (buf, 4, byte_order);
 
 	  if (regno == -1 || regno == S390_PSWM_REGNUM)
-	    store_unsigned_integer (psw_p[0], 8, byte_order,
-				    ((pswm & 0xfff7ffff) << 32) |
+	    store_unsigned_integer ((gdb_byte *) regp + S390_PSWM_OFFSET, 8,
+				    byte_order, ((pswm & 0xfff7ffff) << 32) |
 				    (pswa & 0x80000000));
 	  if (regno == -1 || regno == S390_PSWA_REGNUM)
-	    store_unsigned_integer (psw_p[1], 8, byte_order,
-				    pswa & 0x7fffffff);
+	    store_unsigned_integer ((gdb_byte *) regp + S390_PSWA_OFFSET, 8,
+				    byte_order, pswa & 0x7fffffff);
 	}
       return;
     }
 #endif
 
-  s390_native_collect (regcache, regmap_gregset, regno, (gdb_byte *) regp);
+  regcache_collect_regset (&s390_gregset, regcache, regno, regp,
+			   sizeof (gregset_t));
 }
 
 /* Fill GDB's register array with the floating-point register values
@@ -200,7 +174,8 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
 void
 supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
 {
-  s390_native_supply (regcache, regmap_fpregset, (const gdb_byte *) regp);
+  regcache_supply_regset (&s390_fpregset, regcache, -1, regp,
+			  sizeof (fpregset_t));
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
@@ -209,7 +184,8 @@ supply_fpregset (struct regcache *regcache, const fpregset_t *regp)
 void
 fill_fpregset (const struct regcache *regcache, fpregset_t *regp, int regno)
 {
-  s390_native_collect (regcache, regmap_fpregset, regno, (gdb_byte *) regp);
+  regcache_collect_regset (&s390_fpregset, regcache, regno, regp,
+			   sizeof (fpregset_t));
 }
 
 /* Find the TID for the current inferior thread to use with ptrace.  */
@@ -298,12 +274,13 @@ store_fpregs (const struct regcache *regcache, int tid, int regnum)
     perror_with_name (_("Couldn't write floating point status"));
 }
 
-/* Fetch all registers in the kernel's register set whose number is REGSET,
-   whose size is REGSIZE, and whose layout is described by REGMAP, from
-   process/thread TID and store their values in GDB's register cache.  */
+/* Fetch all registers in the kernel's register set whose number is
+   REGSET_ID, whose size is REGSIZE, and whose layout is described by
+   REGSET, from process/thread TID and store their values in GDB's
+   register cache.  */
 static void
 fetch_regset (struct regcache *regcache, int tid,
-	      int regset, int regsize, const short *regmap)
+	      int regset_id, int regsize, const struct regset *regset)
 {
   gdb_byte *buf = alloca (regsize);
   struct iovec iov;
@@ -311,23 +288,23 @@ fetch_regset (struct regcache *regcache, int tid,
   iov.iov_base = buf;
   iov.iov_len = regsize;
 
-  if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
+  if (ptrace (PTRACE_GETREGSET, tid, (long) regset_id, (long) &iov) < 0)
     {
       if (errno == ENODATA)
-	s390_native_supply (regcache, regmap, NULL);
+	regcache_supply_regset (regset, regcache, -1, NULL, regsize);
       else
 	perror_with_name (_("Couldn't get register set"));
     }
   else
-    s390_native_supply (regcache, regmap, buf);
+    regcache_supply_regset (regset, regcache, -1, buf, regsize);
 }
 
-/* Store all registers in the kernel's register set whose number is REGSET,
-   whose size is REGSIZE, and whose layout is described by REGMAP, from
-   GDB's register cache back to process/thread TID.  */
+/* Store all registers in the kernel's register set whose number is
+   REGSET_ID, whose size is REGSIZE, and whose layout is described by
+   REGSET, from GDB's register cache back to process/thread TID.  */
 static void
 store_regset (struct regcache *regcache, int tid,
-	      int regset, int regsize, const short *regmap)
+	      int regset_id, int regsize, const struct regset *regset)
 {
   gdb_byte *buf = alloca (regsize);
   struct iovec iov;
@@ -335,12 +312,12 @@ store_regset (struct regcache *regcache, int tid,
   iov.iov_base = buf;
   iov.iov_len = regsize;
 
-  if (ptrace (PTRACE_GETREGSET, tid, (long) regset, (long) &iov) < 0)
+  if (ptrace (PTRACE_GETREGSET, tid, (long) regset_id, (long) &iov) < 0)
     perror_with_name (_("Couldn't get register set"));
 
-  s390_native_collect (regcache, regmap, -1, buf);
+  regcache_collect_regset (regset, regcache, -1, buf, regsize);
 
-  if (ptrace (PTRACE_SETREGSET, tid, (long) regset, (long) &iov) < 0)
+  if (ptrace (PTRACE_SETREGSET, tid, (long) regset_id, (long) &iov) < 0)
     perror_with_name (_("Couldn't set register set"));
 }
 
@@ -379,17 +356,17 @@ s390_linux_fetch_inferior_registers (struct target_ops *ops,
     if (regnum == -1 || regnum == S390_LAST_BREAK_REGNUM)
       fetch_regset (regcache, tid, NT_S390_LAST_BREAK, 8,
 		    (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32
-		     ? s390_regmap_last_break : s390x_regmap_last_break));
+		     ? &s390_last_break_regset : &s390x_last_break_regset));
 
   if (have_regset_system_call)
     if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
       fetch_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
-		    s390_regmap_system_call);
+		    &s390_system_call_regset);
 
   if (have_regset_tdb)
     if (regnum == -1 || S390_IS_TDBREGSET_REGNUM (regnum))
       fetch_regset (regcache, tid, NT_S390_TDB, s390_sizeof_tdbregset,
-		    s390_regmap_tdb);
+		    &s390_tdb_regset);
 }
 
 /* Store register REGNUM back into the child process.  If REGNUM is
@@ -411,7 +388,7 @@ s390_linux_store_inferior_registers (struct target_ops *ops,
   if (have_regset_system_call)
     if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
       store_regset (regcache, tid, NT_S390_SYSTEM_CALL, 4,
-		    s390_regmap_system_call);
+		    &s390_system_call_regset);
 }
 
 
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 9ab5c70..731ff40 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -419,204 +419,61 @@ s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 
 /* Maps for register sets.  */
 
-const short s390_regmap_gregset[] =
+static const struct regcache_map_entry s390_gregmap[] =
   {
-    0x00, S390_PSWM_REGNUM,
-    0x04, S390_PSWA_REGNUM,
-    0x08, S390_R0_REGNUM,
-    0x0c, S390_R1_REGNUM,
-    0x10, S390_R2_REGNUM,
-    0x14, S390_R3_REGNUM,
-    0x18, S390_R4_REGNUM,
-    0x1c, S390_R5_REGNUM,
-    0x20, S390_R6_REGNUM,
-    0x24, S390_R7_REGNUM,
-    0x28, S390_R8_REGNUM,
-    0x2c, S390_R9_REGNUM,
-    0x30, S390_R10_REGNUM,
-    0x34, S390_R11_REGNUM,
-    0x38, S390_R12_REGNUM,
-    0x3c, S390_R13_REGNUM,
-    0x40, S390_R14_REGNUM,
-    0x44, S390_R15_REGNUM,
-    0x48, S390_A0_REGNUM,
-    0x4c, S390_A1_REGNUM,
-    0x50, S390_A2_REGNUM,
-    0x54, S390_A3_REGNUM,
-    0x58, S390_A4_REGNUM,
-    0x5c, S390_A5_REGNUM,
-    0x60, S390_A6_REGNUM,
-    0x64, S390_A7_REGNUM,
-    0x68, S390_A8_REGNUM,
-    0x6c, S390_A9_REGNUM,
-    0x70, S390_A10_REGNUM,
-    0x74, S390_A11_REGNUM,
-    0x78, S390_A12_REGNUM,
-    0x7c, S390_A13_REGNUM,
-    0x80, S390_A14_REGNUM,
-    0x84, S390_A15_REGNUM,
-    0x88, S390_ORIG_R2_REGNUM,
-    -1, -1
+    { 1, S390_PSWM_REGNUM },
+    { 1, S390_PSWA_REGNUM },
+    { 16, S390_R0_REGNUM },
+    { 16, S390_A0_REGNUM },
+    { 1, S390_ORIG_R2_REGNUM },
+    { 0 }
   };
 
-const short s390x_regmap_gregset[] =
+static const struct regcache_map_entry s390_fpregmap[] =
   {
-    0x00, S390_PSWM_REGNUM,
-    0x08, S390_PSWA_REGNUM,
-    0x10, S390_R0_REGNUM,
-    0x18, S390_R1_REGNUM,
-    0x20, S390_R2_REGNUM,
-    0x28, S390_R3_REGNUM,
-    0x30, S390_R4_REGNUM,
-    0x38, S390_R5_REGNUM,
-    0x40, S390_R6_REGNUM,
-    0x48, S390_R7_REGNUM,
-    0x50, S390_R8_REGNUM,
-    0x58, S390_R9_REGNUM,
-    0x60, S390_R10_REGNUM,
-    0x68, S390_R11_REGNUM,
-    0x70, S390_R12_REGNUM,
-    0x78, S390_R13_REGNUM,
-    0x80, S390_R14_REGNUM,
-    0x88, S390_R15_REGNUM,
-    0x90, S390_A0_REGNUM,
-    0x94, S390_A1_REGNUM,
-    0x98, S390_A2_REGNUM,
-    0x9c, S390_A3_REGNUM,
-    0xa0, S390_A4_REGNUM,
-    0xa4, S390_A5_REGNUM,
-    0xa8, S390_A6_REGNUM,
-    0xac, S390_A7_REGNUM,
-    0xb0, S390_A8_REGNUM,
-    0xb4, S390_A9_REGNUM,
-    0xb8, S390_A10_REGNUM,
-    0xbc, S390_A11_REGNUM,
-    0xc0, S390_A12_REGNUM,
-    0xc4, S390_A13_REGNUM,
-    0xc8, S390_A14_REGNUM,
-    0xcc, S390_A15_REGNUM,
-    0x10, S390_R0_UPPER_REGNUM,
-    0x18, S390_R1_UPPER_REGNUM,
-    0x20, S390_R2_UPPER_REGNUM,
-    0x28, S390_R3_UPPER_REGNUM,
-    0x30, S390_R4_UPPER_REGNUM,
-    0x38, S390_R5_UPPER_REGNUM,
-    0x40, S390_R6_UPPER_REGNUM,
-    0x48, S390_R7_UPPER_REGNUM,
-    0x50, S390_R8_UPPER_REGNUM,
-    0x58, S390_R9_UPPER_REGNUM,
-    0x60, S390_R10_UPPER_REGNUM,
-    0x68, S390_R11_UPPER_REGNUM,
-    0x70, S390_R12_UPPER_REGNUM,
-    0x78, S390_R13_UPPER_REGNUM,
-    0x80, S390_R14_UPPER_REGNUM,
-    0x88, S390_R15_UPPER_REGNUM,
-    0xd0, S390_ORIG_R2_REGNUM,
-    -1, -1
+    { 1, S390_FPC_REGNUM }, { 4, REGCACHE_MAP_SKIP_BYTES },
+    { 16, S390_F0_REGNUM },
+    { 0 }
   };
 
-const short s390_regmap_fpregset[] =
+static const struct regcache_map_entry s390_regmap_upper[] =
   {
-    0x00, S390_FPC_REGNUM,
-    0x08, S390_F0_REGNUM,
-    0x10, S390_F1_REGNUM,
-    0x18, S390_F2_REGNUM,
-    0x20, S390_F3_REGNUM,
-    0x28, S390_F4_REGNUM,
-    0x30, S390_F5_REGNUM,
-    0x38, S390_F6_REGNUM,
-    0x40, S390_F7_REGNUM,
-    0x48, S390_F8_REGNUM,
-    0x50, S390_F9_REGNUM,
-    0x58, S390_F10_REGNUM,
-    0x60, S390_F11_REGNUM,
-    0x68, S390_F12_REGNUM,
-    0x70, S390_F13_REGNUM,
-    0x78, S390_F14_REGNUM,
-    0x80, S390_F15_REGNUM,
-    -1, -1
+    { 16, S390_R0_UPPER_REGNUM },
+    { 0 }
   };
 
-const short s390_regmap_upper[] =
+static const struct regcache_map_entry s390_regmap_last_break[] =
   {
-    0x00, S390_R0_UPPER_REGNUM,
-    0x04, S390_R1_UPPER_REGNUM,
-    0x08, S390_R2_UPPER_REGNUM,
-    0x0c, S390_R3_UPPER_REGNUM,
-    0x10, S390_R4_UPPER_REGNUM,
-    0x14, S390_R5_UPPER_REGNUM,
-    0x18, S390_R6_UPPER_REGNUM,
-    0x1c, S390_R7_UPPER_REGNUM,
-    0x20, S390_R8_UPPER_REGNUM,
-    0x24, S390_R9_UPPER_REGNUM,
-    0x28, S390_R10_UPPER_REGNUM,
-    0x2c, S390_R11_UPPER_REGNUM,
-    0x30, S390_R12_UPPER_REGNUM,
-    0x34, S390_R13_UPPER_REGNUM,
-    0x38, S390_R14_UPPER_REGNUM,
-    0x3c, S390_R15_UPPER_REGNUM,
-    -1, -1
+    { 1, S390_LAST_BREAK_REGNUM },
+    { 0 }
   };
 
-const short s390_regmap_last_break[] =
+static const struct regcache_map_entry s390x_regmap_last_break[] =
   {
-    0x04, S390_LAST_BREAK_REGNUM,
-    -1, -1
+    { 1, S390_LAST_BREAK_REGNUM },
+    { 0 }
   };
 
-const short s390x_regmap_last_break[] =
+static const struct regcache_map_entry s390_regmap_system_call[] =
   {
-    0x00, S390_LAST_BREAK_REGNUM,
-    -1, -1
+    { 1, S390_SYSTEM_CALL_REGNUM },
+    { 0 }
   };
 
-const short s390_regmap_system_call[] =
+static const struct regcache_map_entry s390_regmap_tdb[] =
   {
-    0x00, S390_SYSTEM_CALL_REGNUM,
-    -1, -1
+    { 1, S390_TDB_DWORD0_REGNUM },
+    { 1, S390_TDB_ABORT_CODE_REGNUM },
+    { 1, S390_TDB_CONFLICT_TOKEN_REGNUM },
+    { 1, S390_TDB_ATIA_REGNUM },
+    { 96, REGCACHE_MAP_SKIP_BYTES },
+    { 16, S390_TDB_R0_REGNUM },
+    { 0 }
   };
 
-const short s390_regmap_tdb[] =
-  {
-    0x00, S390_TDB_DWORD0_REGNUM,
-    0x08, S390_TDB_ABORT_CODE_REGNUM,
-    0x10, S390_TDB_CONFLICT_TOKEN_REGNUM,
-    0x18, S390_TDB_ATIA_REGNUM,
-    0x80, S390_TDB_R0_REGNUM,
-    0x88, S390_TDB_R1_REGNUM,
-    0x90, S390_TDB_R2_REGNUM,
-    0x98, S390_TDB_R3_REGNUM,
-    0xa0, S390_TDB_R4_REGNUM,
-    0xa8, S390_TDB_R5_REGNUM,
-    0xb0, S390_TDB_R6_REGNUM,
-    0xb8, S390_TDB_R7_REGNUM,
-    0xc0, S390_TDB_R8_REGNUM,
-    0xc8, S390_TDB_R9_REGNUM,
-    0xd0, S390_TDB_R10_REGNUM,
-    0xd8, S390_TDB_R11_REGNUM,
-    0xe0, S390_TDB_R12_REGNUM,
-    0xe8, S390_TDB_R13_REGNUM,
-    0xf0, S390_TDB_R14_REGNUM,
-    0xf8, S390_TDB_R15_REGNUM,
-    -1, -1
-  };
-
-
-/* Supply register REGNUM from the register set REGSET to register cache
-   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
-static void
-s390_supply_regset (const struct regset *regset, struct regcache *regcache,
-		    int regnum, const void *regs, size_t len)
-{
-  const short *map;
-  for (map = regset->descr; map[0] >= 0; map += 2)
-    if (regnum == -1 || regnum == map[1])
-      regcache_raw_supply (regcache, map[1],
-			   regs ? (const char *)regs + map[0] : NULL);
-}
 
-/* Supply the TDB regset.  Like s390_supply_regset, but invalidate the
-   TDB registers unless the TDB format field is valid.  */
+/* Supply the TDB regset.  Like regcache_supply_regset, but invalidate
+   the TDB registers unless the TDB format field is valid.  */
 
 static void
 s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
@@ -626,73 +483,52 @@ s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
   enum register_status ret;
   int i;
 
-  s390_supply_regset (regset, regcache, regnum, regs, len);
+  regcache_supply_regset (regset, regcache, regnum, regs, len);
   ret = regcache_cooked_read_unsigned (regcache, S390_TDB_DWORD0_REGNUM, &tdw);
   if (ret != REG_VALID || (tdw >> 56) != 1)
-    s390_supply_regset (regset, regcache, regnum, NULL, len);
+    regcache_supply_regset (regset, regcache, regnum, NULL, len);
 }
 
-/* Collect register REGNUM from the register cache REGCACHE and store
-   it in the buffer specified by REGS and LEN as described by the
-   general-purpose register set REGSET.  If REGNUM is -1, do this for
-   all registers in REGSET.  */
-static void
-s390_collect_regset (const struct regset *regset,
-		     const struct regcache *regcache,
-		     int regnum, void *regs, size_t len)
-{
-  const short *map;
-  for (map = regset->descr; map[0] >= 0; map += 2)
-    if (regnum == -1 || regnum == map[1])
-      regcache_raw_collect (regcache, map[1], (char *)regs + map[0]);
-}
-
-static const struct regset s390_gregset = {
-  s390_regmap_gregset,
-  s390_supply_regset,
-  s390_collect_regset
+const struct regset s390_gregset = {
+  s390_gregmap,
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
-static const struct regset s390x_gregset = {
-  s390x_regmap_gregset,
-  s390_supply_regset,
-  s390_collect_regset
-};
-
-static const struct regset s390_fpregset = {
-  s390_regmap_fpregset,
-  s390_supply_regset,
-  s390_collect_regset
+const struct regset s390_fpregset = {
+  s390_fpregmap,
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
 static const struct regset s390_upper_regset = {
   s390_regmap_upper,
-  s390_supply_regset,
-  s390_collect_regset
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
-static const struct regset s390_last_break_regset = {
+const struct regset s390_last_break_regset = {
   s390_regmap_last_break,
-  s390_supply_regset,
-  s390_collect_regset
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
-static const struct regset s390x_last_break_regset = {
+const struct regset s390x_last_break_regset = {
   s390x_regmap_last_break,
-  s390_supply_regset,
-  s390_collect_regset
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
-static const struct regset s390_system_call_regset = {
+const struct regset s390_system_call_regset = {
   s390_regmap_system_call,
-  s390_supply_regset,
-  s390_collect_regset
+  regcache_supply_regset,
+  regcache_collect_regset
 };
 
-static const struct regset s390_tdb_regset = {
+const struct regset s390_tdb_regset = {
   s390_regmap_tdb,
   s390_supply_tdb_regset,
-  s390_collect_regset
+  regcache_collect_regset
 };
 
 static struct core_regset_section s390_linux32_regset_sections[] =
@@ -3370,7 +3206,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       break;
 
     case ABI_LINUX_ZSERIES:
-      tdep->gregset = &s390x_gregset;
+      tdep->gregset = &s390_gregset;
       tdep->sizeof_gregset = s390x_sizeof_gregset;
       tdep->fpregset = &s390_fpregset;
       tdep->sizeof_fpregset = s390_sizeof_fpregset;
diff --git a/gdb/s390-linux-tdep.h b/gdb/s390-linux-tdep.h
index 52bed9d..1e12000 100644
--- a/gdb/s390-linux-tdep.h
+++ b/gdb/s390-linux-tdep.h
@@ -150,15 +150,14 @@
 
 /* Core file register sets, defined in s390-tdep.c.  */
 #define s390_sizeof_gregset 0x90
-extern const short s390_regmap_gregset[];
 #define s390x_sizeof_gregset 0xd8
-extern const short s390x_regmap_gregset[];
+extern const struct regset s390_gregset;
 #define s390_sizeof_fpregset 0x88
-extern const short s390_regmap_fpregset[];
-extern const short s390_regmap_last_break[];
-extern const short s390x_regmap_last_break[];
-extern const short s390_regmap_system_call[];
-extern const short s390_regmap_tdb[];
+extern const struct regset s390_fpregset;
+extern const struct regset s390_last_break_regset;
+extern const struct regset s390x_last_break_regset;
+extern const struct regset s390_system_call_regset;
+extern const struct regset s390_tdb_regset;
 #define s390_sizeof_tdbregset 0x100
 
 /* GNU/Linux target descriptions.  */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 14/23] AARCH64 Linux: Fill 'collect_regset' in regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (12 preceding siblings ...)
  2014-04-28  9:54 ` [RFC 13/23] S390: Migrate to regcache_supply/collect_regset Andreas Arnez
@ 2014-04-28  9:55 ` Andreas Arnez
  2014-04-28  9:56 ` [RFC 15/23] ALPHA " Andreas Arnez
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Earnshaw

In order to provide 'collect_regset' support, the generic function
regcache_collect_regset is exploited.  Since this requires writing
appropriate register maps, these can be used for supply_regset as
well.

gdb/
	* aarch64-linux-nat.c (fill_gregset, fill_fpregset): Replace logic
	by call to regcache_collect_regset.
	(supply_gregset, supply_fpregset): Call regcache_supply_regset
	instead of aarch64_linux_supply_gregset/_fpregset.
	* aarch64-linux-tdep.c (AARCH64_LINUX_SIZEOF_GREGSET)
	(AARCH64_LINUX_SIZEOF_FPREGSET): Delete macros here, move to
	header file instead.
	(aarch64_linux_supply_gregset, supply_gregset_from_core)
	(aarch64_linux_suply_fpregset, supply_fpregset_from_core): Delete
	functions.  Move logic to ...
	(aarch64_linux_gregmap, aarch64_linux_fpregmap): ... these new
	register maps.
	(aarch64_linux_gregset, aarch64_linux_fpregset): Make global,
	refer to new register maps, replace *_regset_from_core by
	regcache_supply_regset, and also use regcache_collect_regset.
	* aarch64-linux-tdep.h: Include "regset.h".
	(aarch64_linux_supply_gregset, aarch64_linux_supply_fpregset):
	Delete prototypes.
	(AARCH64_LINUX_SIZEOF_GREGSET, AARCH64_LINUX_SIZEOF_FPREGSET): New
	macros, moved from C source file.
	(aarch64_linux_gregset, aarch64_linux_fpregset): New global
	variable declarations.
---
 gdb/aarch64-linux-nat.c  | 38 +++++++-------------
 gdb/aarch64-linux-tdep.c | 90 +++++++++++++-----------------------------------
 gdb/aarch64-linux-tdep.h | 18 +++++++---
 3 files changed, 48 insertions(+), 98 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 28ad38b..bc9beb0 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -615,14 +615,9 @@ void
 fill_gregset (const struct regcache *regcache,
 	      gdb_gregset_t *gregsetp, int regno)
 {
-  gdb_byte *gregs_buf = (gdb_byte *) gregsetp;
-  int i;
-
-  for (i = AARCH64_X0_REGNUM; i <= AARCH64_CPSR_REGNUM; i++)
-    if (regno == -1 || regno == i)
-      regcache_raw_collect (regcache, i,
-			    gregs_buf + X_REGISTER_SIZE
-			    * (i - AARCH64_X0_REGNUM));
+  regcache_collect_regset (&aarch64_linux_gregset, regcache,
+			   regno, (gdb_byte *) gregsetp,
+			   AARCH64_LINUX_SIZEOF_GREGSET);
 }
 
 /* Fill GDB's register array with the general-purpose register values
@@ -631,7 +626,9 @@ fill_gregset (const struct regcache *regcache,
 void
 supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
 {
-  aarch64_linux_supply_gregset (regcache, (const gdb_byte *) gregsetp);
+  regcache_supply_regset (&aarch64_linux_gregset, regcache, -1,
+			  (const gdb_byte *) gregsetp,
+			  AARCH64_LINUX_SIZEOF_GREGSET);
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
@@ -642,22 +639,9 @@ void
 fill_fpregset (const struct regcache *regcache,
 	       gdb_fpregset_t *fpregsetp, int regno)
 {
-  gdb_byte *fpregs_buf = (gdb_byte *) fpregsetp;
-  int i;
-
-  for (i = AARCH64_V0_REGNUM; i <= AARCH64_V31_REGNUM; i++)
-    if (regno == -1 || regno == i)
-      regcache_raw_collect (regcache, i,
-			    fpregs_buf + V_REGISTER_SIZE
-			    * (i - AARCH64_V0_REGNUM));
-
-  if (regno == -1 || regno == AARCH64_FPSR_REGNUM)
-    regcache_raw_collect (regcache, AARCH64_FPSR_REGNUM,
-			  fpregs_buf + V_REGISTER_SIZE * 32);
-
-  if (regno == -1 || regno == AARCH64_FPCR_REGNUM)
-    regcache_raw_collect (regcache, AARCH64_FPCR_REGNUM,
-			  fpregs_buf + V_REGISTER_SIZE * 32 + 4);
+  regcache_collect_regset (&aarch64_linux_fpregset, regcache,
+			   regno, (gdb_byte *) fpregsetp,
+			   AARCH64_LINUX_SIZEOF_FPREGSET);
 }
 
 /* Fill GDB's register array with the floating-point register values
@@ -666,7 +650,9 @@ fill_fpregset (const struct regcache *regcache,
 void
 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 {
-  aarch64_linux_supply_fpregset (regcache, (const gdb_byte *) fpregsetp);
+  regcache_supply_regset (&aarch64_linux_fpregset, regcache, -1,
+			  (const gdb_byte *) fpregsetp,
+			  AARCH64_LINUX_SIZEOF_FPREGSET);
 }
 
 /* Called when resuming a thread.
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 6f52c8c..8e30d74 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -41,16 +41,6 @@
 #include "user-regs.h"
 #include <ctype.h>
 
-/* The general-purpose regset consists of 31 X registers, plus SP, PC,
-   and PSTATE registers, as defined in the AArch64 port of the Linux
-   kernel.  */
-#define AARCH64_LINUX_SIZEOF_GREGSET  (34 * X_REGISTER_SIZE)
-
-/* The fp regset consists of 32 V registers, plus FPCR and FPSR which
-   are 4 bytes wide each, and the whole structure is padded to 128 bit
-   alignment.  */
-#define AARCH64_LINUX_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
-
 /* Signal frame handling.
 
       +----------+  ^
@@ -185,71 +175,37 @@ static const struct tramp_frame aarch64_linux_rt_sigframe =
   aarch64_linux_sigframe_init
 };
 
-/* Fill GDB's register array with the general-purpose register values
-   in the buffer pointed by GREGS_BUF.  */
-
-void
-aarch64_linux_supply_gregset (struct regcache *regcache,
-			      const gdb_byte *gregs_buf)
-{
-  int regno;
-
-  for (regno = AARCH64_X0_REGNUM; regno <= AARCH64_CPSR_REGNUM; regno++)
-    regcache_raw_supply (regcache, regno,
-			 gregs_buf + X_REGISTER_SIZE
-			 * (regno - AARCH64_X0_REGNUM));
-}
-
-/* The "supply_regset" function for the general-purpose register set.  */
-
-static void
-supply_gregset_from_core (const struct regset *regset,
-			  struct regcache *regcache,
-			  int regnum, const void *regbuf, size_t len)
-{
-  aarch64_linux_supply_gregset (regcache, (const gdb_byte *) regbuf);
-}
-
-/* Fill GDB's register array with the floating-point register values
-   in the buffer pointed by FPREGS_BUF.  */
+/* Register maps.  */
 
-void
-aarch64_linux_supply_fpregset (struct regcache *regcache,
-			       const gdb_byte *fpregs_buf)
-{
-  int regno;
-
-  for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
-    regcache_raw_supply (regcache, regno,
-			 fpregs_buf + V_REGISTER_SIZE
-			 * (regno - AARCH64_V0_REGNUM));
-
-  regcache_raw_supply (regcache, AARCH64_FPSR_REGNUM,
-		       fpregs_buf + V_REGISTER_SIZE * 32);
-  regcache_raw_supply (regcache, AARCH64_FPCR_REGNUM,
-		       fpregs_buf + V_REGISTER_SIZE * 32 + 4);
-}
-
-/* The "supply_regset" function for the floating-point register set.  */
+static const struct regcache_map_entry aarch64_linux_gregmap[] =
+  {
+    { 31, AARCH64_X0_REGNUM },	/* x0 ... x30 */
+    { 1, AARCH64_SP_REGNUM },
+    { 1, AARCH64_PC_REGNUM },
+    { 1, AARCH64_CPSR_REGNUM },
+    { 0 }
+  };
 
-static void
-supply_fpregset_from_core (const struct regset *regset,
-			   struct regcache *regcache,
-			   int regnum, const void *regbuf, size_t len)
-{
-  aarch64_linux_supply_fpregset (regcache, (const gdb_byte *) regbuf);
-}
+static const struct regcache_map_entry aarch64_linux_fpregmap[] =
+  {
+    { 32, AARCH64_V0_REGNUM },	/* v0 ... v31 */
+    { 1, AARCH64_FPSR_REGNUM },
+    { 1, AARCH64_FPCR_REGNUM },
+    { 0 }
+  };
 
-/* Register set definitions. */
+/* Register set definitions.  */
 
-static const struct regset aarch64_linux_gregset =
+const struct regset aarch64_linux_gregset =
   {
-    NULL, supply_gregset_from_core, NULL
+    aarch64_linux_gregmap,
+    regcache_supply_regset, regcache_collect_regset
   };
 
-static const struct regset aarch64_linux_fpregset =
+const struct regset aarch64_linux_fpregset =
   {
-    NULL, supply_fpregset_from_core, NULL
+    aarch64_linux_fpregmap,
+    regcache_supply_regset, regcache_collect_regset
   };
 
 /* Implement the "regset_from_core_section" gdbarch method.  */
diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h
index 48c7092..2e1de60 100644
--- a/gdb/aarch64-linux-tdep.h
+++ b/gdb/aarch64-linux-tdep.h
@@ -18,9 +18,17 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-struct regcache;
+#include "regset.h"
 
-extern void aarch64_linux_supply_gregset (struct regcache *regcache,
-					  const gdb_byte *gregs_buf);
-extern void aarch64_linux_supply_fpregset (struct regcache *regcache,
-					   const gdb_byte *fpregs_buf);
+/* The general-purpose regset consists of 31 X registers, plus SP, PC,
+   and PSTATE registers, as defined in the AArch64 port of the Linux
+   kernel.  */
+#define AARCH64_LINUX_SIZEOF_GREGSET  (34 * X_REGISTER_SIZE)
+
+/* The fp regset consists of 32 V registers, plus FPCR and FPSR which
+   are 4 bytes wide each, and the whole structure is padded to 128 bit
+   alignment.  */
+#define AARCH64_LINUX_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
+
+extern const struct regset aarch64_linux_gregset;
+extern const struct regset aarch64_linux_fpregset;
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 15/23] ALPHA Linux: Fill 'collect_regset' in regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (13 preceding siblings ...)
  2014-04-28  9:55 ` [RFC 14/23] AARCH64 Linux: Fill 'collect_regset' in regset structures Andreas Arnez
@ 2014-04-28  9:56 ` Andreas Arnez
  2014-04-28  9:57 ` [RFC 16/23] FRV " Andreas Arnez
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Henderson


gdb/
	* alpha-linux-tdep.c (alpha_linux_supply_gregset): Replace logic
	by call to alpha_supply_int_regs.
	(alpha_linux_collect_gregset): New function.
	(alpha_linux_supply_fpregset): Replace logic by call to
	alpha_supply_fp_regs.
	(alpha_linux_collect_fpregset): New function.
	(alpha_linux_gregset, alpha_linux_fpregset): Add collect method.
---
 gdb/alpha-linux-tdep.c | 56 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 21 deletions(-)

diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 52f19d0..51bce4f 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -166,21 +166,27 @@ alpha_linux_supply_gregset (const struct regset *regset,
 			    int regnum, const void *gregs, size_t len)
 {
   const gdb_byte *regs = gregs;
-  int i;
+
   gdb_assert (len >= 32 * 8);
+  alpha_supply_int_regs (regcache, regnum, regs, regs + 31 * 8,
+			 len >= 33 * 8 ? regs + 32 * 8 : NULL);
+}
 
-  for (i = 0; i < ALPHA_ZERO_REGNUM; i++)
-    {
-      if (regnum == i || regnum == -1)
-	regcache_raw_supply (regcache, i, regs + i * 8);
-    }
+/* Collect register REGNUM from the register cache REGCACHE and store
+   it in the buffer specified by GREGS and LEN as described by the
+   general-purpose register set REGSET.  If REGNUM is -1, do this for
+   all registers in REGSET.  */
 
-  if (regnum == ALPHA_PC_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_PC_REGNUM, regs + 31 * 8);
+static void
+alpha_linux_collect_gregset (const struct regset *regset,
+			     const struct regcache *regcache,
+			     int regnum, void *gregs, size_t len)
+{
+  gdb_byte *regs = gregs;
 
-  if (regnum == ALPHA_UNIQUE_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_UNIQUE_REGNUM,
-			 len >= 33 * 8 ? regs + 32 * 8 : NULL);
+  gdb_assert (len >= 32 * 8);
+  alpha_fill_int_regs (regcache, regnum, regs, regs + 31 * 8,
+		       len >= 33 * 8 ? regs + 32 * 8 : NULL);
 }
 
 /* Supply register REGNUM from the buffer specified by FPREGS and LEN
@@ -193,29 +199,37 @@ alpha_linux_supply_fpregset (const struct regset *regset,
 			     int regnum, const void *fpregs, size_t len)
 {
   const gdb_byte *regs = fpregs;
-  int i;
+
   gdb_assert (len >= 32 * 8);
+  alpha_supply_fp_regs (regcache, regnum, regs, regs + 31 * 8);
+}
 
-  for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; i++)
-    {
-      if (regnum == i || regnum == -1)
-	regcache_raw_supply (regcache, i, regs + (i - ALPHA_FP0_REGNUM) * 8);
-    }
+/* Collect register REGNUM from the register cache REGCACHE and store
+   it in the buffer specified by FPREGS and LEN as described by the
+   general-purpose register set REGSET.  If REGNUM is -1, do this for
+   all registers in REGSET.  */
 
-  if (regnum == ALPHA_FPCR_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8);
+static void
+alpha_linux_collect_fpregset (const struct regset *regset,
+			      const struct regcache *regcache,
+			      int regnum, void *fpregs, size_t len)
+{
+  gdb_byte *regs = fpregs;
+
+  gdb_assert (len >= 32 * 8);
+  alpha_fill_fp_regs (regcache, regnum, regs, regs + 31 * 8);
 }
 
 static const struct regset alpha_linux_gregset =
 {
   NULL,
-  alpha_linux_supply_gregset
+  alpha_linux_supply_gregset, alpha_linux_collect_gregset
 };
 
 static const struct regset alpha_linux_fpregset =
 {
   NULL,
-  alpha_linux_supply_fpregset
+  alpha_linux_supply_fpregset, alpha_linux_collect_fpregset
 };
 
 /* Return the appropriate register set for the core section identified
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 16/23] FRV Linux: Fill 'collect_regset' in regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (14 preceding siblings ...)
  2014-04-28  9:56 ` [RFC 15/23] ALPHA " Andreas Arnez
@ 2014-04-28  9:57 ` Andreas Arnez
  2014-04-28  9:58 ` [RFC 17/23] HPPA " Andreas Arnez
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:57 UTC (permalink / raw)
  To: gdb-patches


gdb/
	* frv-linux-tdep.c (FRV_PT_PSR, FRV_PT_ISR, FRV_PT_CCR)
	(FRV_PT_CCCR, FRV_PT_LR, FRV_PT_LCR, FRV_PT_PC, FRV_PT_GNER0)
	(FRV_PT_GNER1, FRV_PT_IACC0H, FRV_PT_IACC0L, FRV_PT_GR)
	(FRV_PT_TBR, FRV_PT_GR, FRV_PT_EXEC_FDPIC_LOADMAP)
	(FRV_PT_INTERP_FDPIC_LOADMAP): Delete macros.
	(frv_linux_gregmap, frv_linux_fpregmap): New register maps.
	(frv_linux_supply_gregset): Replace main logic by call to
	regcache_supply_regset, but keep clearing gr32-gr63.
	(frv_linux_supply_fpregset): Delete function.
	(frv_linux_gregset): Refer to appropriate register map and add
	regcache_collect_regset as the collect method.
	(frv_linux_fpregset): Likewise.  Also exchange the supply method
	by regcache_supply_regset.
---
 gdb/frv-linux-tdep.c | 141 ++++++++++++++++++++-------------------------------
 1 file changed, 54 insertions(+), 87 deletions(-)

diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index fb163a8..104e6c1 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -360,37 +360,52 @@ typedef struct
   frv_elf_fpreg_t fsr[1];
 } frv_elf_fpregset_t;
 
-/* Constants for accessing elements of frv_elf_gregset_t.  */
-
-#define FRV_PT_PSR 0
-#define	FRV_PT_ISR 1
-#define FRV_PT_CCR 2
-#define FRV_PT_CCCR 3
-#define FRV_PT_LR 4
-#define FRV_PT_LCR 5
-#define FRV_PT_PC 6
-#define FRV_PT_GNER0 10
-#define FRV_PT_GNER1 11
-#define FRV_PT_IACC0H 12
-#define FRV_PT_IACC0L 13
-
-/* Note: Only 32 of the GRs will be found in the corefile.  */
-#define FRV_PT_GR(j)	( 14 + (j))	/* GRj for 0<=j<=63.  */
-
-#define FRV_PT_TBR FRV_PT_GR(0)		/* gr0 is always 0, so TBR is stuffed
-					   there.  */
-
-/* Technically, the loadmap addresses are not part of `pr_reg' as
-   found in the elf_prstatus struct.  The fields which communicate the
-   loadmap address appear (by design) immediately after `pr_reg'
-   though, and the BFD function elf32_frv_grok_prstatus() has been
-   implemented to include these fields in the register section that it
-   extracts from the core file.  So, for our purposes, they may be
-   viewed as registers.  */
-
-#define FRV_PT_EXEC_FDPIC_LOADMAP 46
-#define FRV_PT_INTERP_FDPIC_LOADMAP 47
-
+/* Register maps.  */
+
+static const struct regcache_map_entry frv_linux_gregmap[] =
+  {
+    { 1, psr_regnum },
+    { 4, REGCACHE_MAP_SKIP_BYTES }, /* isr */
+    { 1, ccr_regnum },
+    { 1, cccr_regnum },
+    { 1, lr_regnum },
+    { 1, lcr_regnum },
+    { 1, pc_regnum },
+    { 4, REGCACHE_MAP_SKIP_BYTES }, /* __status */
+    { 4, REGCACHE_MAP_SKIP_BYTES }, /* syscallno */
+    { 4, REGCACHE_MAP_SKIP_BYTES }, /* orig_gr8 */
+    { 1, gner0_regnum },
+    { 1, gner1_regnum },
+    { 8, REGCACHE_MAP_SKIP_BYTES }, /* iacc0 */
+    { 1, tbr_regnum },
+    { 31, first_gpr_regnum + 1 }, /* gr1 ... gr31 */
+
+    /* Technically, the loadmap addresses are not part of `pr_reg' as
+       found in the elf_prstatus struct.  The fields which communicate
+       the loadmap address appear (by design) immediately after
+       `pr_reg' though, and the BFD function elf32_frv_grok_prstatus()
+       has been implemented to include these fields in the register
+       section that it extracts from the core file.  So, for our
+       purposes, they may be viewed as registers.  */
+
+    { 1, fdpic_loadmap_exec_regnum },
+    { 1, fdpic_loadmap_interp_regnum },
+    { 0 }
+  };
+
+static const struct regcache_map_entry frv_linux_fpregmap[] =
+  {
+    { 64, first_fpr_regnum },	/* fr0 ... fr63 */
+    { 1, fner0_regnum },
+    { 1, fner1_regnum },
+    { 1, msr0_regnum },
+    { 1, msr1_regnum },
+    { 8, acc0_regnum },		/* acc0 ... acc7 */
+    { 1, accg0123_regnum },
+    { 1, accg4567_regnum },
+    { 1, fsr0_regnum },
+    { 0 }
+  };
 
 /* Unpack an frv_elf_gregset_t into GDB's register cache.  */
 
@@ -401,7 +416,6 @@ frv_linux_supply_gregset (const struct regset *regset,
 {
   int regi;
   char zerobuf[MAX_REGISTER_SIZE];
-  const frv_elf_gregset_t *gregsetp = gregs;
 
   memset (zerobuf, 0, MAX_REGISTER_SIZE);
 
@@ -409,72 +423,25 @@ frv_linux_supply_gregset (const struct regset *regset,
      this slot.  */
   regcache_raw_supply (regcache, first_gpr_regnum, zerobuf);
 
-  for (regi = first_gpr_regnum + 1; regi <= last_gpr_regnum; regi++)
-    {
-      if (regi >= first_gpr_regnum + 32)
-	regcache_raw_supply (regcache, regi, zerobuf);
-      else
-	regcache_raw_supply (regcache, regi,
-			     gregsetp->reg[FRV_PT_GR (regi
-						      - first_gpr_regnum)]);
-    }
-
-  regcache_raw_supply (regcache, pc_regnum, gregsetp->reg[FRV_PT_PC]);
-  regcache_raw_supply (regcache, psr_regnum, gregsetp->reg[FRV_PT_PSR]);
-  regcache_raw_supply (regcache, ccr_regnum, gregsetp->reg[FRV_PT_CCR]);
-  regcache_raw_supply (regcache, cccr_regnum, gregsetp->reg[FRV_PT_CCCR]);
-  regcache_raw_supply (regcache, lr_regnum, gregsetp->reg[FRV_PT_LR]);
-  regcache_raw_supply (regcache, lcr_regnum, gregsetp->reg[FRV_PT_LCR]);
-  regcache_raw_supply (regcache, gner0_regnum, gregsetp->reg[FRV_PT_GNER0]);
-  regcache_raw_supply (regcache, gner1_regnum, gregsetp->reg[FRV_PT_GNER1]);
-  regcache_raw_supply (regcache, tbr_regnum, gregsetp->reg[FRV_PT_TBR]);
-  regcache_raw_supply (regcache, fdpic_loadmap_exec_regnum,
-                       gregsetp->reg[FRV_PT_EXEC_FDPIC_LOADMAP]);
-  regcache_raw_supply (regcache, fdpic_loadmap_interp_regnum,
-                       gregsetp->reg[FRV_PT_INTERP_FDPIC_LOADMAP]);
-}
-
-/* Unpack an frv_elf_fpregset_t into GDB's register cache.  */
-
-static void
-frv_linux_supply_fpregset (const struct regset *regset,
-                           struct regcache *regcache,
-			   int regnum, const void *gregs, size_t len)
-{
-  int regi;
-  const frv_elf_fpregset_t *fpregsetp = gregs;
-
-  for (regi = first_fpr_regnum; regi <= last_fpr_regnum; regi++)
-    regcache_raw_supply (regcache, regi,
-			 fpregsetp->fr[regi - first_fpr_regnum]);
-
-  regcache_raw_supply (regcache, fner0_regnum, fpregsetp->fner[0]);
-  regcache_raw_supply (regcache, fner1_regnum, fpregsetp->fner[1]);
-
-  regcache_raw_supply (regcache, msr0_regnum, fpregsetp->msr[0]);
-  regcache_raw_supply (regcache, msr1_regnum, fpregsetp->msr[1]);
+  /* Fill gr32, ..., gr63 with zeros. */
+  for (regi = first_gpr_regnum + 32; regi <= last_gpr_regnum; regi++)
+    regcache_raw_supply (regcache, regi, zerobuf);
 
-  for (regi = acc0_regnum; regi <= acc7_regnum; regi++)
-    regcache_raw_supply (regcache, regi, fpregsetp->acc[regi - acc0_regnum]);
-
-  regcache_raw_supply (regcache, accg0123_regnum, fpregsetp->accg);
-  regcache_raw_supply (regcache, accg4567_regnum, fpregsetp->accg + 4);
-
-  regcache_raw_supply (regcache, fsr0_regnum, fpregsetp->fsr[0]);
+  regcache_supply_regset (regset, regcache, regnum, gregs, len);
 }
 
 /* FRV Linux kernel register sets.  */
 
 static const struct regset frv_linux_gregset =
 {
-  NULL,
-  frv_linux_supply_gregset
+  frv_linux_gregmap,
+  frv_linux_supply_gregset, regcache_collect_regset
 };
 
 static const struct regset frv_linux_fpregset =
 {
-  NULL,
-  frv_linux_supply_fpregset
+  frv_linux_fpregmap,
+  regcache_supply_regset, regcache_collect_regset
 };
 
 static const struct regset *
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 17/23] HPPA Linux: Fill 'collect_regset' in regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (15 preceding siblings ...)
  2014-04-28  9:57 ` [RFC 16/23] FRV " Andreas Arnez
@ 2014-04-28  9:58 ` Andreas Arnez
  2014-04-28  9:59 ` [RFC 19/23] NIOS2 Linux: Fill 'collect_regset' in regset structure Andreas Arnez
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Randolph Chung


gdb/
	* hppa-linux-tdep.c (greg_map): Rename to...
	(hppa_linux_gregmap): ... this.  Also convert to
	regcache_map_entry format.
	(hppa_linux_supply_regset): Delete function.
	(hppa_linux_supply_fpregset): Delete function.  Move logic to...
	(hppa_linux_fpregmap): ... this new register map.
	(hppa_linux_regset, hppa_linux_fpregset): Refer to appropriate
	register map, replace supply method by regcache_supply_regset, and
	add collect method regcache_collect_regset.
---
 gdb/hppa-linux-tdep.c | 101 +++++++++++++++++---------------------------------
 1 file changed, 34 insertions(+), 67 deletions(-)

diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 7a765a2..af57e6c 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -423,84 +423,51 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
  * cr10, cr15
  */
 
-#define GR_REGNUM(_n)	(HPPA_R0_REGNUM+_n)
-#define TR_REGNUM(_n)	(HPPA_TR0_REGNUM+_n)
-static const int greg_map[] =
+static const struct regcache_map_entry hppa_linux_gregmap[] =
   {
-    GR_REGNUM(0), GR_REGNUM(1), GR_REGNUM(2), GR_REGNUM(3),
-    GR_REGNUM(4), GR_REGNUM(5), GR_REGNUM(6), GR_REGNUM(7),
-    GR_REGNUM(8), GR_REGNUM(9), GR_REGNUM(10), GR_REGNUM(11),
-    GR_REGNUM(12), GR_REGNUM(13), GR_REGNUM(14), GR_REGNUM(15),
-    GR_REGNUM(16), GR_REGNUM(17), GR_REGNUM(18), GR_REGNUM(19),
-    GR_REGNUM(20), GR_REGNUM(21), GR_REGNUM(22), GR_REGNUM(23),
-    GR_REGNUM(24), GR_REGNUM(25), GR_REGNUM(26), GR_REGNUM(27),
-    GR_REGNUM(28), GR_REGNUM(29), GR_REGNUM(30), GR_REGNUM(31),
-
-    HPPA_SR4_REGNUM+1, HPPA_SR4_REGNUM+2, HPPA_SR4_REGNUM+3, HPPA_SR4_REGNUM+4,
-    HPPA_SR4_REGNUM, HPPA_SR4_REGNUM+5, HPPA_SR4_REGNUM+6, HPPA_SR4_REGNUM+7,
-
-    HPPA_PCOQ_HEAD_REGNUM, HPPA_PCOQ_TAIL_REGNUM,
-    HPPA_PCSQ_HEAD_REGNUM, HPPA_PCSQ_TAIL_REGNUM,
-
-    HPPA_SAR_REGNUM, HPPA_IIR_REGNUM, HPPA_ISR_REGNUM, HPPA_IOR_REGNUM,
-    HPPA_IPSW_REGNUM, HPPA_RCR_REGNUM,
-
-    TR_REGNUM(0), TR_REGNUM(1), TR_REGNUM(2), TR_REGNUM(3),
-    TR_REGNUM(4), TR_REGNUM(5), TR_REGNUM(6), TR_REGNUM(7),
-
-    HPPA_PID0_REGNUM, HPPA_PID1_REGNUM, HPPA_PID2_REGNUM, HPPA_PID3_REGNUM,
-    HPPA_CCR_REGNUM, HPPA_EIEM_REGNUM,
+    { 32, HPPA_R0_REGNUM },
+    { 1, HPPA_SR4_REGNUM+1 },
+    { 1, HPPA_SR4_REGNUM+2 },
+    { 1, HPPA_SR4_REGNUM+3 },
+    { 1, HPPA_SR4_REGNUM+4 },
+    { 1, HPPA_SR4_REGNUM },
+    { 1, HPPA_SR4_REGNUM+5 },
+    { 1, HPPA_SR4_REGNUM+6 },
+    { 1, HPPA_SR4_REGNUM+7 },
+    { 1, HPPA_PCOQ_HEAD_REGNUM },
+    { 1, HPPA_PCOQ_TAIL_REGNUM },
+    { 1, HPPA_PCSQ_HEAD_REGNUM },
+    { 1, HPPA_PCSQ_TAIL_REGNUM },
+    { 1, HPPA_SAR_REGNUM },
+    { 1, HPPA_IIR_REGNUM },
+    { 1, HPPA_ISR_REGNUM },
+    { 1, HPPA_IOR_REGNUM },
+    { 1, HPPA_IPSW_REGNUM },
+    { 1, HPPA_RCR_REGNUM },
+    { 8, HPPA_TR0_REGNUM },
+    { 4, HPPA_PID0_REGNUM },
+    { 1, HPPA_CCR_REGNUM },
+    { 1, HPPA_EIEM_REGNUM },
+    { 0 }
   };
 
-static void
-hppa_linux_supply_regset (const struct regset *regset,
-			  struct regcache *regcache,
-			  int regnum, const void *regs, size_t len)
-{
-  struct gdbarch *arch = get_regcache_arch (regcache);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
-  const char *buf = regs;
-  int i, offset;
-
-  offset = 0;
-  for (i = 0; i < ARRAY_SIZE (greg_map); i++)
-    {
-      if (regnum == greg_map[i] || regnum == -1)
-        regcache_raw_supply (regcache, greg_map[i], buf + offset);
-
-      offset += tdep->bytes_per_address;
-    }
-}
-
-static void
-hppa_linux_supply_fpregset (const struct regset *regset,
-			    struct regcache *regcache,
-			    int regnum, const void *regs, size_t len)
-{
-  const char *buf = regs;
-  int i, offset;
-
-  offset = 0;
-  for (i = 0; i < 64; i++)
-    {
-      if (regnum == HPPA_FP0_REGNUM + i || regnum == -1)
-        regcache_raw_supply (regcache, HPPA_FP0_REGNUM + i, 
-			     buf + offset);
-      offset += 4;
-    }
-}
+static const struct regcache_map_entry hppa_linux_fpregmap[] =
+  {
+    { 64, HPPA_FP0_REGNUM },
+    { 0 }
+  };
 
 /* HPPA Linux kernel register set.  */
 static const struct regset hppa_linux_regset =
 {
-  NULL,
-  hppa_linux_supply_regset
+  hppa_linux_gregmap,
+  regcache_supply_regset, regcache_collect_regset
 };
 
 static const struct regset hppa_linux_fpregset =
 {
-  NULL,
-  hppa_linux_supply_fpregset
+  hppa_linux_fpregmap,
+  regcache_supply_regset, regcache_collect_regset
 };
 
 static const struct regset *
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 19/23] NIOS2 Linux: Fill 'collect_regset' in regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (16 preceding siblings ...)
  2014-04-28  9:58 ` [RFC 17/23] HPPA " Andreas Arnez
@ 2014-04-28  9:59 ` Andreas Arnez
  2014-04-28  9:59 ` [RFC 18/23] M32R " Andreas Arnez
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi


gdb/
	* nios2-linux-tdep.c (NIOS2_GREGS_SIZE): New macro.
	(nios2_collect_gregset): New function.
	(nios2_core_regset): Add collect method.
---
 gdb/nios2-linux-tdep.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index 84ab576..f4cacf6 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -51,6 +51,8 @@ static const int reg_offsets[NIOS2_NUM_REGS] =
   -1, -1, -1, -1, -1, -1, -1, -1
 };
 
+#define NIOS2_GREGS_SIZE (4 * 31)
+
 /* Implement the supply_regset hook for core files.  */
 
 static void
@@ -73,11 +75,26 @@ nios2_supply_gregset (const struct regset *regset,
       }
 }
 
+static void
+nios2_collect_gregset (const struct regset *regset,
+		       const struct regcache *regcache,
+		       int regnum, void *gregs_buf, size_t len)
+{
+  gdb_byte *gregs = gregs_buf;
+  int regno;
+
+  for (regno = NIOS2_Z_REGNUM; regno <= NIOS2_MPUACC_REGNUM; regno++)
+    if (regnum == -1 || regnum == regno)
+      {
+	if (reg_offsets[regno] != -1)
+	  regcache_raw_collect (regcache, regno,
+				gregs + 4 * reg_offsets[regno]);
+      }
+}
+
 static const struct regset nios2_core_regset =
 {
-  NULL,
-  nios2_supply_gregset,
-  NULL,
+  NULL, nios2_supply_gregset, nios2_collect_gregset
 };
 
 /* Implement the regset_from_core_section gdbarch method.  */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 18/23] M32R Linux: Fill 'collect_regset' in regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (17 preceding siblings ...)
  2014-04-28  9:59 ` [RFC 19/23] NIOS2 Linux: Fill 'collect_regset' in regset structure Andreas Arnez
@ 2014-04-28  9:59 ` Andreas Arnez
  2014-04-28 10:00 ` [RFC 20/23] SCORE: " Andreas Arnez
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28  9:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kei Sakamoto


gdb/
	* m32r-linux-tdep.c (M32R_LINUX_GREGS_SIZE): New macro.
	(m32r_linux_supply_gregset): Make platform-independent and don't
	write to read-only input buffer.
	(m32r_linux_collect_gregset): New function.
	(m32r_linux_gregset): Add collect method.
---
 gdb/m32r-linux-tdep.c | 81 +++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 63 insertions(+), 18 deletions(-)

diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index bf1ffff..5eaca6e 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -346,19 +346,26 @@ static int m32r_pt_regs_offset[] = {
 #define SPU_OFFSET (4 * 23)
 #define SPI_OFFSET (4 * 26)
 
+#define M32R_LINUX_GREGS_SIZE (4 * 27)
+
 static void
 m32r_linux_supply_gregset (const struct regset *regset,
 			   struct regcache *regcache, int regnum,
 			   const void *gregs, size_t size)
 {
-  const char *regs = gregs;
-  unsigned long psw, bbpsw;
+  const gdb_byte *regs = gregs;
+  enum bfd_endian byte_order =
+    gdbarch_byte_order (get_regcache_arch (regcache));
+  ULONGEST psw, bbpsw;
+  gdb_byte buf[4];
+  const gdb_byte *p;
   int i;
 
-  psw = *((unsigned long *) (regs + PSW_OFFSET));
-  bbpsw = *((unsigned long *) (regs + BBPSW_OFFSET));
+  psw = extract_unsigned_integer (regs + PSW_OFFSET, 4, byte_order);
+  bbpsw = extract_unsigned_integer (regs + BBPSW_OFFSET, 4, byte_order);
+  psw = ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
 
-  for (i = 0; i < sizeof (m32r_pt_regs_offset) / 4; i++)
+  for (i = 0; i < ARRAY_SIZE (m32r_pt_regs_offset); i++)
     {
       if (regnum != -1 && regnum != i)
 	continue;
@@ -366,30 +373,68 @@ m32r_linux_supply_gregset (const struct regset *regset,
       switch (i)
 	{
 	case PSW_REGNUM:
-	  *((unsigned long *) (regs + m32r_pt_regs_offset[i])) =
-	    ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
+	  store_unsigned_integer (buf, 4, byte_order, psw);
+	  p = buf;
 	  break;
 	case CBR_REGNUM:
-	  *((unsigned long *) (regs + m32r_pt_regs_offset[i])) =
-	    ((psw >> 8) & 1);
+	  store_unsigned_integer (buf, 4, byte_order, psw & 1);
+	  p = buf;
 	  break;
 	case M32R_SP_REGNUM:
-	  if (psw & 0x8000)
-	    *((unsigned long *) (regs + m32r_pt_regs_offset[i])) =
-	      *((unsigned long *) (regs + SPU_OFFSET));
-	  else
-	    *((unsigned long *) (regs + m32r_pt_regs_offset[i])) =
-	      *((unsigned long *) (regs + SPI_OFFSET));
+	  p = regs + ((psw & 0x80) ? SPU_OFFSET : SPI_OFFSET);
 	  break;
+	default:
+	  p = regs + m32r_pt_regs_offset[i];
 	}
 
-      regcache_raw_supply (regcache, i,
-			   regs + m32r_pt_regs_offset[i]);
+      regcache_raw_supply (regcache, i, p);
+    }
+}
+
+static void
+m32r_linux_collect_gregset (const struct regset *regset,
+			    const struct regcache *regcache,
+			    int regnum, void *gregs, size_t size)
+{
+  gdb_byte *regs = gregs;
+  int i;
+  enum bfd_endian byte_order =
+    gdbarch_byte_order (get_regcache_arch (regcache));
+  ULONGEST psw;
+  gdb_byte buf[4];
+
+  regcache_raw_collect (regcache, PSW_REGNUM, buf);
+  psw = extract_unsigned_integer (buf, 4, byte_order);
+
+  for (i = 0; i < ARRAY_SIZE (m32r_pt_regs_offset); i++)
+    {
+      if (regnum != -1 && regnum != i)
+	continue;
+
+      switch (i)
+	{
+	case PSW_REGNUM:
+	  store_unsigned_integer (regs + PSW_OFFSET, 4, byte_order,
+				  (psw & 0xc1) << 8);
+	  store_unsigned_integer (regs + BBPSW_OFFSET, 4, byte_order,
+				  (psw >> 8) & 0xc1);
+	  break;
+	case CBR_REGNUM:
+	  break;
+	case M32R_SP_REGNUM:
+	  regcache_raw_collect (regcache, i, regs
+				+ ((psw & 0x80) ? SPU_OFFSET : SPI_OFFSET));
+	  break;
+	default:
+	  regcache_raw_collect (regcache, i,
+				regs + m32r_pt_regs_offset[i]);
+	}
     }
 }
 
 static const struct regset m32r_linux_gregset = {
-  NULL, m32r_linux_supply_gregset
+  NULL,
+  m32r_linux_supply_gregset, m32r_linux_collect_gregset
 };
 
 static const struct regset *
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 20/23] SCORE: Fill 'collect_regset' in regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (18 preceding siblings ...)
  2014-04-28  9:59 ` [RFC 18/23] M32R " Andreas Arnez
@ 2014-04-28 10:00 ` Andreas Arnez
  2014-04-28 10:01 ` [RFC 21/23] TILEGX Linux: " Andreas Arnez
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28 10:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Qinwei


gdb/
	* score-tdep.c (score7_linux_supply_gregset): Delete function.
	Move logic to...
	(score7_linux_gregmap): ... this new register map.
	(SCORE7_LINUX_SIZEOF_GREGSET): New macro.
	(score7_linux_gregset): Refer to register map, replace supply
	method by regcache_supply_regset, and add collect method.
	(score7_linux_regset_from_core_section): Replace
	sizeof(elf_gregset_t) by SCORE7_LINUX_SIZEOF_GREGSET.
	* score-tdep.h (SCORE_EPC_REGNUM): New enum value.
	(struct pt_regs): Delete structure definition.
	(elf_gregset_t): Delete typedef.
---
 gdb/score-tdep.c | 72 +++++++++++++++++++-------------------------------------
 gdb/score-tdep.h | 34 +-------------------------
 2 files changed, 25 insertions(+), 81 deletions(-)

diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index c224189..90afdf3 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -1398,59 +1398,34 @@ score_prologue_frame_base_sniffer (struct frame_info *this_frame)
   return &score_prologue_frame_base;
 }
 
-/* Core file support (dirty hack)
-  
-   The core file MUST be generated by GNU/Linux on S+core.  */
-
-static void
-score7_linux_supply_gregset(const struct regset *regset,
-                struct regcache *regcache,
-                int regnum, const void *gregs_buf, size_t len)
-{
-  int regno;
-  elf_gregset_t *gregs;
-
-  gdb_assert (regset != NULL);
-  gdb_assert ((regcache != NULL) && (gregs_buf != NULL));
-
-  gregs = (elf_gregset_t *) gregs_buf;
-
-  for (regno = 0; regno < 32; regno++)
-    if (regnum == -1 || regnum == regno)
-      regcache_raw_supply (regcache, regno, gregs->regs + regno);
+/* Core file support.  */
 
+static const struct regcache_map_entry score7_linux_gregmap[] =
   {
-    struct sreg {
-      int regnum;
-      void *buf;
-    } sregs [] = {
-      { 55, &(gregs->cel) },  /* CEL */
-      { 54, &(gregs->ceh) },  /* CEH */
-      { 53, &(gregs->sr0) },  /* sr0, i.e. cnt or COUNTER */
-      { 52, &(gregs->sr1) },  /* sr1, i.e. lcr or LDCR */
-      { 51, &(gregs->sr1) },  /* sr2, i.e. scr or STCR */
-
-      /* Exception occured at this address, exactly the PC we want */
-      { 49, &(gregs->cp0_epc) }, /* PC */
-
-      { 38, &(gregs->cp0_ema) }, /* EMA */
-      { 37, &(gregs->cp0_epc) }, /* EPC */
-      { 34, &(gregs->cp0_ecr) }, /* ECR */
-      { 33, &(gregs->cp0_condition) }, /* COND */
-      { 32, &(gregs->cp0_psr) }, /* PSR */
-    };
+    { 7 * 4, REGCACHE_MAP_SKIP_BYTES },
+    { 32, 0 },			/* r0 ... r31 */
+    { 1, 55 },			/* CEL */
+    { 1, 54 },			/* CEH */
+    { 1, 53 },			/* sr0, i.e. cnt or COUNTER */
+    { 1, 52 },			/* sr1, i.e. lcr or LDCR */
+    { 1, 51 },			/* sr2, i.e. scr or STCR */
+    /* EPC and PC are stored in the same slot.  */
+    { 1, 37 },			/* EPC */
+    { -4, REGCACHE_MAP_SKIP_BYTES },
+    { 1, 49 },			/* PC */
+    { 1, 38 },			/* EMA */
+    { 1, 32 },			/* PSR */
+    { 1, 34 },			/* ECR */
+    { 1, 33 },			/* COND */
+    { 0 }
+  };
 
-    for (regno = 0; regno < sizeof(sregs)/sizeof(sregs[0]); regno++)
-      if (regnum == -1 || regnum == sregs[regno].regnum)
-	regcache_raw_supply (regcache,
-			     sregs[regno].regnum, sregs[regno].buf);
-  }
-}
+#define SCORE7_LINUX_SIZEOF_GREGSET 196
 
 static const struct regset score7_linux_gregset =
   {
-    NULL,
-    score7_linux_supply_gregset, NULL
+    score7_linux_gregmap,
+    regcache_supply_regset, regcache_collect_regset
   };
 
 /* Return the appropriate register set from the core section identified
@@ -1463,7 +1438,8 @@ score7_linux_regset_from_core_section(struct gdbarch *gdbarch,
   gdb_assert (gdbarch != NULL);
   gdb_assert (sect_name != NULL);
 
-  if (strcmp(sect_name, ".reg") == 0 && sect_size == sizeof(elf_gregset_t))
+  if (strcmp(sect_name, ".reg") == 0
+      && sect_size == SCORE7_LINUX_SIZEOF_GREGSET)
     return &score7_linux_gregset;
 
   return NULL;
diff --git a/gdb/score-tdep.h b/gdb/score-tdep.h
index 02a334e..cef0e6a 100644
--- a/gdb/score-tdep.h
+++ b/gdb/score-tdep.h
@@ -32,6 +32,7 @@ enum gdb_regnum
   SCORE_RA_REGNUM = 3,
   SCORE_A0_REGNUM = 4,
   SCORE_AL_REGNUM = 7,
+  SCORE_EPC_REGNUM = 37,
   SCORE_PC_REGNUM = 49,
 };
 
@@ -46,37 +47,4 @@ enum gdb_regnum
 #define SCORE_INSTLEN          4
 #define SCORE16_INSTLEN        2
 
-/* Forward declarations.  */
-struct regset;
-
-/* Linux Core file support (dirty hack)
-  
-   S+core Linux register set definition, copy from S+core Linux.  */
-struct pt_regs {
-    /* Pad bytes for argument save space on the stack.  */
-    unsigned long pad0[6]; /* may be 4, MIPS accept 6var, SCore
-			      accepts 4 Var--yuchen */
-
-    /* Saved main processor registers.  */
-    unsigned long orig_r4;
-    unsigned long regs[32];
-
-    /* Other saved registers.  */
-    unsigned long cel;
-    unsigned long ceh;
-
-    unsigned long sr0;  /*cnt*/
-    unsigned long sr1;  /*lcr*/
-    unsigned long sr2;  /*scr*/
-
-    /* saved cp0 registers */
-    unsigned long cp0_epc;
-    unsigned long cp0_ema;
-    unsigned long cp0_psr;
-    unsigned long cp0_ecr;
-    unsigned long cp0_condition;
-};
-
-typedef struct pt_regs elf_gregset_t;
-
 #endif /* SCORE_TDEP_H */
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 21/23] TILEGX Linux: Fill 'collect_regset' in regset structure
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (19 preceding siblings ...)
  2014-04-28 10:00 ` [RFC 20/23] SCORE: " Andreas Arnez
@ 2014-04-28 10:01 ` Andreas Arnez
  2014-04-28 10:01 ` [RFC 22/23] M68K Linux: Define regset structures Andreas Arnez
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28 10:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jiong Wang


gdb/
	* tilegx-linux-tdep.c (tilegx_linux_supply_regset): Delete
	function.  Move logic to...
	(tilegx_linux_regmap): ... this new register map.
	(TILEGX_GREGS_SIZE): New enum value.
	(tilegx_linux_regset): Refer to register map, replace supply
	method by regcache_supply_regset, and add collect method.
---
 gdb/tilegx-linux-tdep.c | 37 +++++++++++++++----------------------
 1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index 98b03db..4169433 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -73,34 +73,27 @@ static const struct tramp_frame tilegx_linux_rt_sigframe =
   tilegx_linux_sigframe_init
 };
 
-/* Supply raw registers from REGCACHE to REGS.  */
+/* Register map; must match struct pt_regs in "ptrace.h".  */
 
-static void
-tilegx_linux_supply_regset (const struct regset *regset,
-			    struct regcache *regcache,
-			    int regnum, const void *regs, size_t len)
-{
-  struct gdbarch *arch = get_regcache_arch (regcache);
-  const char *ptr = regs;
-  int i;
-
-  /* This logic must match that of struct pt_regs in "ptrace.h".  */
-  for (i = 0; i < TILEGX_NUM_EASY_REGS + 2; i++, ptr += tilegx_reg_size)
-    {
-      int gri = (i < TILEGX_NUM_EASY_REGS)
-                 ? i : (i == TILEGX_NUM_EASY_REGS)
-                        ? TILEGX_PC_REGNUM : TILEGX_FAULTNUM_REGNUM;
+static const struct regcache_map_entry tilegx_linux_regmap[] =
+  {
+    { TILEGX_NUM_EASY_REGS, 0 },
+    { 1, TILEGX_PC_REGNUM },
+    { 1, TILEGX_FAULTNUM_REGNUM },
+    { 0 }
+  };
 
-      if (regnum == gri || regnum == -1)
-	regcache_raw_supply (regcache, gri, ptr);
-    }
-}
+enum
+{
+  TILEGX_GREGS_SIZE = (TILEGX_NUM_EASY_REGS + 2) * tilegx_reg_size
+};
 
 /* TILE-Gx Linux kernel register set.  */
+
 static const struct regset tilegx_linux_regset =
 {
-  NULL,
-  tilegx_linux_supply_regset
+  tilegx_linux_regmap,
+  regcache_supply_regset, regcache_collect_regset
 };
 
 static const struct regset *
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 22/23] M68K Linux: Define regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (20 preceding siblings ...)
  2014-04-28 10:01 ` [RFC 21/23] TILEGX Linux: " Andreas Arnez
@ 2014-04-28 10:01 ` Andreas Arnez
  2014-04-28 10:02 ` [RFC 23/23] IA64 " Andreas Arnez
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28 10:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andreas Schwab


gdb/
	* m68klinux-tdep.c: Include "regset.h".
	(m68k_linux_gregmap, m68k_linux_fpregmap): New register maps.
	(M68K_LINUX_GREGS_SIZE, M68K_LINUX_FPREGS_SIZE): New macros.
	(m68k_linux_gregset, m68k_linux_fpregset): New regsets.
	(m68k_linux_regset_from_core_section): New function.
	(m68k_linux_init_abi): Set regset_from_core_section gdbarch
	method.
---
 gdb/m68klinux-tdep.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c
index f6fed38..8967d28 100644
--- a/gdb/m68klinux-tdep.c
+++ b/gdb/m68klinux-tdep.c
@@ -38,6 +38,7 @@
 #include "observer.h"
 #include "elf/common.h"
 #include "linux-tdep.h"
+#include "regset.h"
 \f
 /* Offsets (in target ints) into jmp_buf.  */
 
@@ -327,6 +328,66 @@ static const struct frame_unwind m68k_linux_sigtramp_frame_unwind =
   m68k_linux_sigtramp_frame_sniffer
 };
 
+/* Register maps for supply/collect regset functions.  */
+
+static const struct regcache_map_entry m68k_linux_gregmap[] =
+  {
+    { 7, M68K_D1_REGNUM },	/* d1 ... d7 */
+    { 7, M68K_A0_REGNUM },	/* a0 ... a6 */
+    { 1, M68K_D0_REGNUM },
+    { 1, M68K_SP_REGNUM },
+    { 4, REGCACHE_MAP_SKIP_BYTES }, /* orig_d0 (skip) */
+    { 1, M68K_PS_REGNUM },
+    { 1, M68K_PC_REGNUM },
+    { 0 }
+  };
+
+#define M68K_LINUX_GREGS_SIZE (19 * 4)
+
+static const struct regcache_map_entry m68k_linux_fpregmap[] =
+  {
+    { 8, M68K_FP0_REGNUM },	/* fp0 ... fp7 */
+    { 1, M68K_FPC_REGNUM },
+    { 1, M68K_FPS_REGNUM },
+    { 1, M68K_FPI_REGNUM },
+    { 0 }
+  };
+
+#define M68K_LINUX_FPREGS_SIZE (27 * 4)
+
+/* Register sets. */
+
+static const struct regset m68k_linux_gregset =
+  {
+    m68k_linux_gregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
+static const struct regset m68k_linux_fpregset =
+  {
+    m68k_linux_fpregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
+/* Return the appropriate register set for the core section identified
+   by SECT_NAME and SECT_SIZE.  */
+
+static const struct regset *
+m68k_linux_regset_from_core_section (struct gdbarch *gdbarch,
+				     const char *sect_name,
+				     size_t sect_size)
+{
+  if (strcmp (sect_name, ".reg") == 0
+      && sect_size >= M68K_LINUX_GREGS_SIZE)
+    return &m68k_linux_gregset;
+
+  if (strcmp (sect_name, ".reg2") == 0
+      && sect_size >= M68K_LINUX_FPREGS_SIZE)
+    return &m68k_linux_fpregset;
+
+  return NULL;
+}
+
 static void
 m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -361,6 +422,10 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
+  /* Core file support. */
+  set_gdbarch_regset_from_core_section
+    (gdbarch, m68k_linux_regset_from_core_section);
+
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC 23/23] IA64 Linux: Define regset structures
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (21 preceding siblings ...)
  2014-04-28 10:01 ` [RFC 22/23] M68K Linux: Define regset structures Andreas Arnez
@ 2014-04-28 10:02 ` Andreas Arnez
  2014-04-28 15:29 ` [RFC 00/23] Regset rework preparations Maciej W. Rozycki
  2014-05-05  8:09 ` [ping] " Andreas Arnez
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28 10:02 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jeff Johnston


gdb/
	* ia64-linux-tdep.c: Include "regset.h".
	(ia64_linux_gregmap, ia64_linux_fpregmap): New register maps.
	(IA64_LINUX_GREGS_SIZE, IA64_LINUX_FPREGS_SIZE): New macros.
	(ia64_linux_supply_fpregset): New function.
	(ia64_linux_gregset, ia64_linux_fpregset): New regsets.
	(ia64_linux_regset_from_core_section): New function.
	(ia64_linux_init_abi): Set regset_from_core_section gdbarch
	method.
---
 gdb/ia64-linux-tdep.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index 128924e..9989602 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -26,6 +26,7 @@
 #include "solib-svr4.h"
 #include "symtab.h"
 #include "linux-tdep.h"
+#include "regset.h"
 
 #include <ctype.h>
 
@@ -131,6 +132,88 @@ ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
 	  || isdigit (*s));  /* Literal number.  */
 }
 
+/* Core file support. */
+
+static const struct regcache_map_entry ia64_linux_gregmap[] =
+  {
+    { 32, IA64_GR0_REGNUM },	/* r0 ... r31 */
+    { 8, REGCACHE_MAP_SKIP_BYTES }, /* FIXME: NAT collection bits? */
+    { 1, IA64_PR_REGNUM },
+    { 8, IA64_BR0_REGNUM },	/* b0 ... b7 */
+    { 1, IA64_IP_REGNUM },
+    { 1, IA64_CFM_REGNUM },
+    { 1, IA64_PSR_REGNUM },
+    { 1, IA64_RSC_REGNUM },
+    { 1, IA64_BSP_REGNUM },
+    { 1, IA64_BSPSTORE_REGNUM },
+    { 1, IA64_RNAT_REGNUM },
+    { 1, IA64_CCV_REGNUM },
+    { 1, IA64_UNAT_REGNUM },
+    { 1, IA64_FPSR_REGNUM },
+    { 1, IA64_PFS_REGNUM },
+    { 1, IA64_LC_REGNUM },
+    { 1, IA64_EC_REGNUM },
+    { 0 }
+  };
+
+#define IA64_LINUX_GREGS_SIZE (55 * 8)
+
+static const struct regcache_map_entry ia64_linux_fpregmap[] =
+  {
+    { 128, IA64_FR0_REGNUM },	/* f0 ... f127 */
+    { 0 }
+  };
+
+#define IA64_LINUX_FPREGS_SIZE (128 * 8)
+
+static void
+ia64_linux_supply_fpregset (const struct regset *regset,
+			    struct regcache *regcache,
+			    int regnum, const void *regs, size_t len)
+{
+  const gdb_byte f_zero[16] = { 0 };
+  const gdb_byte f_one[16] =
+    { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+
+  regcache_supply_regset (regset, regcache, regnum, regs, len);
+
+  /* Kernel generated cores have fr1==0 instead of 1.0.  Older GDBs
+     did the same.  So ignore whatever might be recorded in fpregset_t
+     for fr0/fr1 and always supply their expected values.  */
+  if (regnum == -1 || regnum == IA64_FR0_REGNUM)
+    regcache_raw_supply (regcache, IA64_FR0_REGNUM, f_zero);
+  if (regnum == -1 || regnum == IA64_FR1_REGNUM)
+    regcache_raw_supply (regcache, IA64_FR1_REGNUM, f_one);
+}
+
+static const struct regset ia64_linux_gregset =
+  {
+    ia64_linux_gregmap,
+    regcache_supply_regset, regcache_collect_regset
+  };
+
+static const struct regset ia64_linux_fpregset =
+  {
+    ia64_linux_fpregmap,
+    ia64_linux_supply_fpregset, regcache_collect_regset
+  };
+
+static const struct regset *
+ia64_linux_regset_from_core_section (struct gdbarch *gdbarch,
+				     const char *sect_name,
+				     size_t sect_size)
+{
+  if (strcmp (sect_name, ".reg") == 0
+      && sect_size >= IA64_LINUX_GREGS_SIZE)
+    return &ia64_linux_gregset;
+
+  if (strcmp (sect_name, ".reg2") == 0
+      && sect_size >= IA64_LINUX_FPREGS_SIZE)
+    return &ia64_linux_fpregset;
+
+  return NULL;
+}
+
 static void
 ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -161,6 +244,10 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
 
+  /* Core file support. */
+  set_gdbarch_regset_from_core_section (gdbarch,
+					ia64_linux_regset_from_core_section);
+
   /* SystemTap related.  */
   set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
   set_gdbarch_stap_register_indirection_prefixes (gdbarch,
-- 
1.8.4.2

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 00/23] Regset rework preparations
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (22 preceding siblings ...)
  2014-04-28 10:02 ` [RFC 23/23] IA64 " Andreas Arnez
@ 2014-04-28 15:29 ` Maciej W. Rozycki
  2014-04-28 15:38   ` Andreas Arnez
  2014-05-05  8:09 ` [ping] " Andreas Arnez
  24 siblings, 1 reply; 38+ messages in thread
From: Maciej W. Rozycki @ 2014-04-28 15:29 UTC (permalink / raw)
  To: Andreas Arnez; +Cc: gdb-patches, Ulrich Weigand

On Mon, 28 Apr 2014, Andreas Arnez wrote:

> Note that all architecture-specific changes except for S390 are
> completely untested.

 I realise you may have troubles regression testing the load of targets, 
but please at least build patched GDB with the `--enable-64-bit-bfd 
--enable-targets=all' configure options supplied.  Without that step I 
cannot approve the 06/23 MIPS part (although offhand it looks good).  
Thanks for your contribution to the GDB project.

  Maciej

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 05/23] X86: Replace regset_alloc() invocations by static regset structures.
  2014-04-28  9:47 ` [RFC 05/23] X86: " Andreas Arnez
@ 2014-04-28 15:33   ` Mark Kettenis
  2014-04-29  8:58     ` Andreas Arnez
  0 siblings, 1 reply; 38+ messages in thread
From: Mark Kettenis @ 2014-04-28 15:33 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:47:03 +0200
> 
> diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
> index c5ed731..e7041c9 100644
> --- a/gdb/amd64obsd-tdep.c
> +++ b/gdb/amd64obsd-tdep.c
> @@ -49,11 +49,17 @@ amd64obsd_supply_regset (const struct regset *regset,
>  
>    gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
>  
> -  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
> +  i386_gregset.supply_regset (regset, regcache, regnum, regs,
> +			      tdep->sizeof_gregset);

I'm not too happy with the additional level of indirection you're
introducing here.  Don't particularly see the need to do this...

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 00/23] Regset rework preparations
  2014-04-28 15:29 ` [RFC 00/23] Regset rework preparations Maciej W. Rozycki
@ 2014-04-28 15:38   ` Andreas Arnez
  2014-05-08 10:31     ` Andreas Arnez
  0 siblings, 1 reply; 38+ messages in thread
From: Andreas Arnez @ 2014-04-28 15:38 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches, Ulrich Weigand

On Mon, Apr 28 2014, Maciej W. Rozycki wrote:

> On Mon, 28 Apr 2014, Andreas Arnez wrote:
>
>> Note that all architecture-specific changes except for S390 are
>> completely untested.
>
>  I realise you may have troubles regression testing the load of targets, 
> but please at least build patched GDB with the `--enable-64-bit-bfd 
> --enable-targets=all' configure options supplied.  Without that step I 
> cannot approve the 06/23 MIPS part (although offhand it looks good).  
> Thanks for your contribution to the GDB project.

Sorry, I failed to mention it, but I built after each patch with
--enable-targets=all on a 64-bit system.

By "untested" I meant that I didn't run the patched gdb on any targets
other than s390.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 05/23] X86: Replace regset_alloc() invocations by static regset structures.
  2014-04-28 15:33   ` Mark Kettenis
@ 2014-04-29  8:58     ` Andreas Arnez
  0 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-04-29  8:58 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Mon, Apr 28 2014, Mark Kettenis wrote:

>> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
>> Date: Mon, 28 Apr 2014 11:47:03 +0200
>> 
>> diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
>> index c5ed731..e7041c9 100644
>> --- a/gdb/amd64obsd-tdep.c
>> +++ b/gdb/amd64obsd-tdep.c
>> @@ -49,11 +49,17 @@ amd64obsd_supply_regset (const struct regset *regset,
>>  
>>    gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
>>  
>> -  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
>> +  i386_gregset.supply_regset (regset, regcache, regnum, regs,
>> +			      tdep->sizeof_gregset);
>
> I'm not too happy with the additional level of indirection you're
> introducing here.  Don't particularly see the need to do this...

Sure, I can keep i386_supply_gregset as a global function, if you
prefer.  I'll adjust [RFC 05/23] by the patch below.  OK?

--

diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index e7041c9..3a46956 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -49,8 +49,7 @@ amd64obsd_supply_regset (const struct regset *regset,
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
 
-  i386_gregset.supply_regset (regset, regcache, regnum, regs,
-			      tdep->sizeof_gregset);
+  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
   amd64_supply_fxsave (regcache, regnum,
 		       ((const gdb_byte *)regs) + tdep->sizeof_gregset);
 }
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index bee27f8..293e87a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3720,7 +3720,7 @@ i386_value_to_register (struct frame_info *frame, int regnum,
    in the general-purpose register set REGSET to register cache
    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
 
-static void
+void
 i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *gregs, size_t len)
 {
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index fd601f2..e0950a3 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -377,6 +377,13 @@ extern int i386_sigtramp_p (struct frame_info *this_frame);
 extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 				     struct reggroup *group);
 
+/* Supply register REGNUM from the general-purpose register set REGSET
+   to register cache REGCACHE.  If REGNUM is -1, do this for all
+   registers in REGSET.  */
+extern void i386_supply_gregset (const struct regset *regset,
+				 struct regcache *regcache, int regnum,
+				 const void *gregs, size_t len);
+
 /* General-purpose register set. */
 extern const struct regset i386_gregset;
 
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 46b4719..70dd0eb 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -147,8 +147,7 @@ i386obsd_aout_supply_regset (const struct regset *regset,
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
 
-  i386_gregset.supply_regset (regset, regcache, regnum, regs,
-			      tdep->sizeof_gregset);
+  i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
   i387_supply_fsave (regcache, regnum, gregs + tdep->sizeof_gregset);
 }
 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [ping] [RFC 00/23] Regset rework preparations
  2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
                   ` (23 preceding siblings ...)
  2014-04-28 15:29 ` [RFC 00/23] Regset rework preparations Maciej W. Rozycki
@ 2014-05-05  8:09 ` Andreas Arnez
  24 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-05-05  8:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand

On Mon, Apr 28 2014, Andreas Arnez wrote:

> This patch series intends to make regset definitions more similar across
> architectures.  It is the first half of a "regset rework" series which
> (in particular) makes core file handling multi-arch capable for all
> Linux platforms.  Since the whole series seemed too bulky at one go, I
> decided to split it and collect some feedback for the first half before
> going on.

Ping!

https://sourceware.org/ml/gdb-patches/2014-04/msg00560.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 02/23] Remove 'arch' field from regset structure
  2014-04-28  9:40 ` [RFC 02/23] Remove 'arch' field from regset structure Andreas Arnez
@ 2014-05-05  9:32   ` Mark Kettenis
  2014-05-05 13:35     ` Andreas Arnez
  0 siblings, 1 reply; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05  9:32 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches, kevinb, yao

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> 
> Removes the 'arch' field from the regset structure, since it
> represents the only "dynamic" data in a regset.  It was referenced in
> some regset supply- and collect routines, to get access to the gdbarch
> associated with the regset.  Naturally, the affected routines always
> have access to the regcache to be supplied to or collected from.  Thus
> the gdbarch associated with that regcache can be used instead.
> 
> gdb/
> 	* regset.h (struct regset): Remove gdbarch field.
> 	* regset.c (regset_alloc): Drop initialization of gdbarch field.
> 	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
> 	* ppcfbsd-tdep.c (ppc32_fbsd_gregset, ppc64_fbsd_gregset):
> 	Likewise.
> 	* ppc-linux-tdep.c (ppc32_linux_gregset, ppc64_linux_gregset)
> 	(ppc32_linux_fpregset, ppc32_linux_vrregset)
> 	(ppc32_linux_vsxregset): Likewise.
> 	* i386obsd-tdep.c (i386obsd_aout_supply_regset): Get the gdbarch
> 	via the regcache instead of the regset.
> 	* i386-tdep.c (i386_supply_gregset, i386_collect_gregset)
> 	(i386_supply_fpregset, i386_collect_fpregset): Likewise.
> 	* amd64obsd-tdep.c (amd64obsd_supply_regset): Likewise.
> 	* amd64-tdep.c (amd64_supply_fpregset, amd64_collect_fpregset):
> 	Likewise.


The

> -  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
> +  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));

changes make the lines too long.  I suggest changing them to:

  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  const struct gdbarch_tdep *tdep = gdbarch_tdep(gdbarch);

Otherwise, this change is fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 01/23] Constify regset structures.
  2014-04-28  9:39 ` [RFC 01/23] Constify regset structures Andreas Arnez
@ 2014-05-05  9:45   ` Mark Kettenis
  0 siblings, 0 replies; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05  9:45 UTC (permalink / raw)
  To: arnez
  Cc: gdb-patches, kevinb, yao, rearnsha, jiwang, macro, tausq,
	sakamoto.kei, schwab, rth

> From: "Andreas Arnez" <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:39:03 +0200
> 
> Convert (unnecessarily) non-constant static regsets to constant ones.
> 
> gdb/
> 	* alpha-linux-tdep.c (alpha_linux_gregset, alpha_linux_fpregset):
> 	Constify structures.
> 	* alphanbsd-tdep.c (alphanbsd_gregset, alphanbsd_fpregset)
> 	(alphanbsd_aout_gregset): Likewise.
> 	* armbsd-tdep.c (armbsd_gregset, armbsd_fpregset): Likewise.
> 	* frv-linux-tdep.c (frv_linux_gregset, frv_linux_fpregset):
> 	Likewise.
> 	* hppa-hpux-tdep.c (hppa_hpux_regset): Likewise.
> 	* hppa-linux-tdep.c (hppa_linux_regset, hppa_linux_fpregset):
> 	Likewise.
> 	* hppanbsd-tdep.c (hppanbsd_gregset): Likewise.
> 	* hppaobsd-tdep.c (hppaobsd_gregset, hppaobsd_fpregset): Likewise.
> 	* m32r-linux-tdep.c (m32r_linux_gregset): Likewise.
> 	* m68kbsd-tdep.c (m68kbsd_gregset, m68kbsd_fpregset): Likewise.
> 	* m88k-tdep.c (m88k_gregset): Likewise.
> 	* mips64obsd-tdep.c (mips64obsd_gregset): Likewise.
> 	* mipsnbsd-tdep.c (mipsnbsd_gregset, mipsnbsd_fpregset): Likewise.
> 	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
> 	* ppcfbsd-tdep.c (ppc32_fbsd_fpregset): Likewise.
> 	* ppcnbsd-tdep.c (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
> 	* ppcnbsd-tdep.h (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
> 	* ppcobsd-tdep.c (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
> 	* ppcobsd-tdep.h (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
> 	* rs6000-aix-tdep.c (rs6000_aix32_regset, rs6000_aix64_regset):
> 	Likewise.
> 	* sh-tdep.c (sh_corefile_gregset, sh_corefile_fpregset): Likewise.
> 	* sh-tdep.h (sh_corefile_gregset): Likewise.
> 	* tilegx-linux-tdep.c (tilegx_linux_regset): Likewise.
> 	* vax-tdep.c (vax_gregset): Likewise.

Sure.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap"
  2014-04-28  9:51 ` [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap" Andreas Arnez
@ 2014-05-05  9:50   ` Mark Kettenis
  0 siblings, 0 replies; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05  9:50 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:51:13 +0200
> 
> As a preparation for the next patch in this series, this patch clears
> the naming confusion about "regset" versus "sparc*regset".  The latter
> was used to represent the *map* of a register set, not the register
> set itself, and is thus renamed accordingly.
> 
> The following identifiers are renamed:
> 
>   sparc32_bsd_fpregset => sparc32_bsd_fpregmap
>   sparc32_linux_core_gregset => sparc32_linux_core_gregmap
>   sparc32_sol2_fpregset => sparc32_sol2_fpregmap
>   sparc32_sol2_gregset => sparc32_sol2_gregmap
>   sparc32_sunos4_fpregset => sparc32_sunos4_fpregmap
>   sparc32_sunos4_gregset => sparc32_sunos4_gregmap
>   sparc32nbsd_gregset => sparc32nbsd_gregmap
>   sparc64_bsd_fpregset => sparc64_bsd_fpregmap
>   sparc64_linux_core_gregset => sparc64_linux_core_gregmap
>   sparc64_linux_ptrace_gregset => sparc64_linux_ptrace_gregmap
>   sparc64_sol2_fpregset => sparc64_sol2_fpregmap
>   sparc64_sol2_gregset => sparc64_sol2_gregmap
>   sparc64fbsd_gregset => sparc64fbsd_gregmap
>   sparc64nbsd_gregset => sparc64nbsd_gregmap
>   sparc64obsd_core_gregset => sparc64obsd_core_gregmap
>   sparc64obsd_gregset => sparc64obsd_gregmap
>   sparc_fpregset => sparc_fpregmap
>   sparc_gregset => sparc_gregmap
>   sparc_sol2_fpregset => sparc_sol2_fpregmap
>   sparc_sol2_gregset => sparc_sol2_gregmap

Sounds reasonable to me; didn't spot any problems.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures
  2014-04-28  9:52 ` [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures Andreas Arnez
@ 2014-05-05  9:52   ` Mark Kettenis
  0 siblings, 0 replies; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05  9:52 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:52:28 +0200
> 
> gdb/
> 	* sparc-linux-tdep.c (sparc32_linux_gregset)
> 	(sparc32_linux_fpregset): New static regset structures.
> 	(sparc32_linux_init_abi): Drop dynamic regset allocations.
> 	* sparc-tdep.h (struct gdbarch_tdep): Constify 'gregset' and
> 	'fpregset' fields.
> 	* sparc64-linux-tdep.c: (sparc64_linux_gregset)
> 	(sparc64_linux_fpregset): New static regset structures.
> 	(sparc64_linux_init_abi): Drop dynamic regset allocations.
> 	* sparc64fbsd-tdep.c (sparc64fbsd_gregset, sparc64fbsd_fpregset):
> 	New static regset structures.
> 	(sparc64fbsd_init_abi): Drop dynamic regset allocations.
> 	* sparc64nbsd-tdep.c (sparc64nbsd_gregset, sparc64nbsd_fpregset):
> 	New static regset structures.
> 	(sparc64nbsd_init_abi): Drop dynamic regset allocations.
> 	* sparc64obsd-tdep.c (sparc64obsd_gregset, sparc64obsd_fpregset):
> 	New static regset structures.
> 	(sparc64obsd_init_abi): Drop dynamic regset allocations.
> 	* sparcnbsd-tdep.c (sparc32nbsd_gregset, sparc32nbsd_fpregset):
> 	New static regset structures.
> 	(sparc32nbsd_init_abi): Drop dynamic regset allocations.

Fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 11/23] Drop regset_alloc()
  2014-04-28  9:53 ` [RFC 11/23] Drop regset_alloc() Andreas Arnez
@ 2014-05-05  9:53   ` Mark Kettenis
  0 siblings, 0 replies; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05  9:53 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:53:16 +0200
> 
> Now that all invocations of regset_alloc() have been removed, the
> function is dropped.  Since regset_alloc() was the only function
> provided by regset.c, this source file is removed as well.
> 
> gdb/
> 	* Makefile.in (SFILES): Delete "regset.c".
> 	(COMMON_OBS): Delete "regset.o".
> 	* regset.c: Remove.
> 	* regset.h (regset_alloc): Delete prototype.

ok (once all the other diffs have been approved of course)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 12/23] regcache: Add functions suitable for regset_supply/collect.
  2014-04-28  9:54 ` [RFC 12/23] regcache: Add functions suitable for regset_supply/collect Andreas Arnez
@ 2014-05-05 10:02   ` Mark Kettenis
  2014-05-05 15:34     ` Andreas Arnez
  0 siblings, 1 reply; 38+ messages in thread
From: Mark Kettenis @ 2014-05-05 10:02 UTC (permalink / raw)
  To: arnez; +Cc: gdb-patches

> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:54:12 +0200
> 
> These functions are intended to suit all targets that don't require too
> special logic in their regset supply/collect methods.  Having such
> generic functions helps reducing target-specific complexity.
> 
> gdb/
> 	* regcache.c: Include "regset.h".
> 	(regcache_supply_regset, regcache_collect_regset): New functions.
> 	* regcache.h (struct regcache_map_entry): New structure.
> 	(REGCACHE_MAP_SKIP_BYTES): New enum value.
> 	(regcache_supply_regset, regcache_collect_regset): New prototypes.

Sorry, but this doesn't strike me as a particular good interface.
I'd say an approach that uses explicit offsets would be much better.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 02/23] Remove 'arch' field from regset structure
  2014-05-05  9:32   ` Mark Kettenis
@ 2014-05-05 13:35     ` Andreas Arnez
  0 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-05-05 13:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, kevinb, yao

On Mon, May 05 2014, Mark Kettenis wrote:

>> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
>> 
>> Removes the 'arch' field from the regset structure, since it
>> represents the only "dynamic" data in a regset.  It was referenced in
>> some regset supply- and collect routines, to get access to the gdbarch
>> associated with the regset.  Naturally, the affected routines always
>> have access to the regcache to be supplied to or collected from.  Thus
>> the gdbarch associated with that regcache can be used instead.
>> 
>> gdb/
>> 	* regset.h (struct regset): Remove gdbarch field.
>> 	* regset.c (regset_alloc): Drop initialization of gdbarch field.
>> 	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
>> 	* ppcfbsd-tdep.c (ppc32_fbsd_gregset, ppc64_fbsd_gregset):
>> 	Likewise.
>> 	* ppc-linux-tdep.c (ppc32_linux_gregset, ppc64_linux_gregset)
>> 	(ppc32_linux_fpregset, ppc32_linux_vrregset)
>> 	(ppc32_linux_vsxregset): Likewise.
>> 	* i386obsd-tdep.c (i386obsd_aout_supply_regset): Get the gdbarch
>> 	via the regcache instead of the regset.
>> 	* i386-tdep.c (i386_supply_gregset, i386_collect_gregset)
>> 	(i386_supply_fpregset, i386_collect_fpregset): Likewise.
>> 	* amd64obsd-tdep.c (amd64obsd_supply_regset): Likewise.
>> 	* amd64-tdep.c (amd64_supply_fpregset, amd64_collect_fpregset):
>> 	Likewise.
>
>
> The
>
>> -  const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
>> +  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
>
> changes make the lines too long.  I suggest changing them to:
>
>   struct gdbarch *gdbarch = get_regcache_arch (regcache);
>   const struct gdbarch_tdep *tdep = gdbarch_tdep(gdbarch);

Done.  (Adjusted patch 02/23 with the patch below.)

> Otherwise, this change is fine with me.

Thanks for reviewing!

--

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index df4a3f4..1b9797a 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2842,7 +2842,8 @@ static void
 amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		       int regnum, const void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (len == tdep->sizeof_fpregset);
   amd64_supply_fxsave (regcache, regnum, fpregs);
@@ -2858,7 +2859,8 @@ amd64_collect_fpregset (const struct regset *regset,
 			const struct regcache *regcache,
 			int regnum, void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (len == tdep->sizeof_fpregset);
   amd64_collect_fxsave (regcache, regnum, fpregs);
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index c5ed731..2cc0a0f 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -45,7 +45,8 @@ amd64obsd_supply_regset (const struct regset *regset,
 			 struct regcache *regcache, int regnum,
 			 const void *regs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index de783f6..7d2363f 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3724,7 +3724,8 @@ void
 i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
 		     int regnum, const void *gregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const gdb_byte *regs = gregs;
   int i;
 
@@ -3748,7 +3749,8 @@ i386_collect_gregset (const struct regset *regset,
 		      const struct regcache *regcache,
 		      int regnum, void *gregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   gdb_byte *regs = gregs;
   int i;
 
@@ -3770,7 +3772,8 @@ static void
 i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
 		      int regnum, const void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (len == I387_SIZEOF_FXSAVE)
     {
@@ -3792,7 +3795,8 @@ i386_collect_fpregset (const struct regset *regset,
 		       const struct regcache *regcache,
 		       int regnum, void *fpregs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (len == I387_SIZEOF_FXSAVE)
     {
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index bc29606..7d9ba93 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -142,7 +142,8 @@ i386obsd_aout_supply_regset (const struct regset *regset,
 			     struct regcache *regcache, int regnum,
 			     const void *regs, size_t len)
 {
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   const gdb_byte *gregs = regs;
 
   gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 12/23] regcache: Add functions suitable for regset_supply/collect.
  2014-05-05 10:02   ` Mark Kettenis
@ 2014-05-05 15:34     ` Andreas Arnez
  0 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-05-05 15:34 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

On Mon, May 05 2014, Mark Kettenis wrote:

>> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
>> Date: Mon, 28 Apr 2014 11:54:12 +0200
>> 
>> These functions are intended to suit all targets that don't require too
>> special logic in their regset supply/collect methods.  Having such
>> generic functions helps reducing target-specific complexity.
>> 
>> gdb/
>> 	* regcache.c: Include "regset.h".
>> 	(regcache_supply_regset, regcache_collect_regset): New functions.
>> 	* regcache.h (struct regcache_map_entry): New structure.
>> 	(REGCACHE_MAP_SKIP_BYTES): New enum value.
>> 	(regcache_supply_regset, regcache_collect_regset): New prototypes.
>
> Sorry, but this doesn't strike me as a particular good interface.
> I'd say an approach that uses explicit offsets would be much better.

And this is because...?

Existing maps greatly differ.  There are lists of offset/regnum tuples,
or arrays of regnums where the indexes implicitly represent offsets, or
the other way around, or something completely special.  In addition to
maps, many targets have special logic in their supply/collect functions,
and in some cases there are not even any maps, but only code.  Thus,
finding a map format that suits most of the existing targets seems like
a fairly difficult task to me.  Nevertheless, I tried, and I considered
all of the above approaches (including "explicit-offset" map formats),
and more.

Here are some reasons why I ended up with this format:

* The "look and feel" is similar to a structure definition with array
  members.  This seems straightforward and makes a map easily comparable
  to a "struct pt_regs" or such.

* The same map is usable for different word sizes.

* Maps are usually shorter than with other existing map formats.

* With this format, there are cases where I could reduce or completely
  eliminate the special logic in the supply/collect functions.

If it helps to widen the use of the map format, I'd be happy to adjust
it, but I'm hesitant to give up these benefits.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [RFC 00/23] Regset rework preparations
  2014-04-28 15:38   ` Andreas Arnez
@ 2014-05-08 10:31     ` Andreas Arnez
  0 siblings, 0 replies; 38+ messages in thread
From: Andreas Arnez @ 2014-05-08 10:31 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches, Ulrich Weigand

On Mon, Apr 28 2014, Andreas Arnez wrote:

> On Mon, Apr 28 2014, Maciej W. Rozycki wrote:
>
>> On Mon, 28 Apr 2014, Andreas Arnez wrote:
>>
>>> Note that all architecture-specific changes except for S390 are
>>> completely untested.
>>
>>  I realise you may have troubles regression testing the load of targets, 
>> but please at least build patched GDB with the `--enable-64-bit-bfd 
>> --enable-targets=all' configure options supplied.  Without that step I 
>> cannot approve the 06/23 MIPS part (although offhand it looks good).  
>> Thanks for your contribution to the GDB project.
>
> Sorry, I failed to mention it, but I built after each patch with
> --enable-targets=all on a 64-bit system.
>
> By "untested" I meant that I didn't run the patched gdb on any targets
> other than s390.

I guess that satisfies your request?

Please let me know if you have any other comments to patch 06/23 (or to
any other patch in the series).

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2014-05-08 10:31 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  9:35 [RFC 00/23] Regset rework preparations Andreas Arnez
2014-04-28  9:39 ` [RFC 01/23] Constify regset structures Andreas Arnez
2014-05-05  9:45   ` Mark Kettenis
2014-04-28  9:40 ` [RFC 02/23] Remove 'arch' field from regset structure Andreas Arnez
2014-05-05  9:32   ` Mark Kettenis
2014-05-05 13:35     ` Andreas Arnez
2014-04-28  9:44 ` [RFC 03/23] AARCH64: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-04-28  9:46 ` [RFC 04/23] ARM: " Andreas Arnez
2014-04-28  9:47 ` [RFC 05/23] X86: " Andreas Arnez
2014-04-28 15:33   ` Mark Kettenis
2014-04-29  8:58     ` Andreas Arnez
2014-04-28  9:48 ` [RFC 06/23] MIPS: " Andreas Arnez
2014-04-28  9:49 ` [RFC 07/23] MN10300: " Andreas Arnez
2014-04-28  9:50 ` [RFC 08/23] SCORE: Replace regset_alloc() invocation by a static regset structure Andreas Arnez
2014-04-28  9:51 ` [RFC 09/23] SPARC: Rename register maps from "*regset" to "*regmap" Andreas Arnez
2014-05-05  9:50   ` Mark Kettenis
2014-04-28  9:52 ` [RFC 10/23] SPARC: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-05-05  9:52   ` Mark Kettenis
2014-04-28  9:53 ` [RFC 11/23] Drop regset_alloc() Andreas Arnez
2014-05-05  9:53   ` Mark Kettenis
2014-04-28  9:54 ` [RFC 12/23] regcache: Add functions suitable for regset_supply/collect Andreas Arnez
2014-05-05 10:02   ` Mark Kettenis
2014-05-05 15:34     ` Andreas Arnez
2014-04-28  9:54 ` [RFC 13/23] S390: Migrate to regcache_supply/collect_regset Andreas Arnez
2014-04-28  9:55 ` [RFC 14/23] AARCH64 Linux: Fill 'collect_regset' in regset structures Andreas Arnez
2014-04-28  9:56 ` [RFC 15/23] ALPHA " Andreas Arnez
2014-04-28  9:57 ` [RFC 16/23] FRV " Andreas Arnez
2014-04-28  9:58 ` [RFC 17/23] HPPA " Andreas Arnez
2014-04-28  9:59 ` [RFC 19/23] NIOS2 Linux: Fill 'collect_regset' in regset structure Andreas Arnez
2014-04-28  9:59 ` [RFC 18/23] M32R " Andreas Arnez
2014-04-28 10:00 ` [RFC 20/23] SCORE: " Andreas Arnez
2014-04-28 10:01 ` [RFC 21/23] TILEGX Linux: " Andreas Arnez
2014-04-28 10:01 ` [RFC 22/23] M68K Linux: Define regset structures Andreas Arnez
2014-04-28 10:02 ` [RFC 23/23] IA64 " Andreas Arnez
2014-04-28 15:29 ` [RFC 00/23] Regset rework preparations Maciej W. Rozycki
2014-04-28 15:38   ` Andreas Arnez
2014-05-08 10:31     ` Andreas Arnez
2014-05-05  8:09 ` [ping] " Andreas Arnez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).