aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2014-04-01 06:57:34 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2014-08-07 17:31:49 +0200
commit1d6e7555155ecf7ac7e24380c776febdf1e469be (patch)
tree54d1311546e794c3b9b17a6972bfb27fbc943a2d
parentd4d793bfeb836e833e36237f9e22d91d629ff0df (diff)
downloadgdb-1d6e7555155ecf7ac7e24380c776febdf1e469be.zip
gdb-1d6e7555155ecf7ac7e24380c776febdf1e469be.tar.gz
gdb-1d6e7555155ecf7ac7e24380c776febdf1e469be.tar.bz2
ALPHA Linux: Fill 'collect_regset' in regset structures.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/alpha-linux-tdep.c56
2 files changed, 45 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e6032d4..82b4fe0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index a571fd9..51ce1a7 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -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