ALPHA Linux: Fill 'collect_regset' in regset structures.
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Tue, 1 Apr 2014 06:57:34 +0000 (06:57 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 7 Aug 2014 15:31:49 +0000 (17:31 +0200)
gdb/ChangeLog
gdb/alpha-linux-tdep.c

index e6032d4..82b4fe0 100644 (file)
@@ -1,5 +1,15 @@
 2014-08-07  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
+       * 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.
+
+2014-08-07  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
        * aarch64-linux-nat.c (fill_gregset, fill_fpregset): Replace logic
        by call to regcache_collect_regset.
        (supply_gregset, supply_fpregset): Call regcache_supply_regset
index a571fd9..51ce1a7 100644 (file)
@@ -164,21 +164,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
@@ -191,29 +197,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