summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-07-30 15:07:38 +0100
committerYao Qi <yao.qi@linaro.org>2015-07-30 15:07:38 +0100
commitdeca266c89cf61c679f759a74bdf362960b0cc2c (patch)
treea2eaf8048934260c9089bbb96c191d7c816a0546
parentec74129274bf2fb65aac9381a19731c570f7be29 (diff)
downloadbinutils-gdb-deca266c89cf61c679f759a74bdf362960b0cc2c.tar.gz
Don't use arm_regmap and arm_num_regs in arm_fill_gregset and arm_store_gregset
In order to align with arm-linux-nat.c counterparts, we don't use arm_num_regs and arm_regmap in functions arm_fill_gregset and arm_store_gregset. Instead, we use register numbers. With this patch applied, arm_fill_gregset and arm_store_gregset don't need arm_num_regs and arm_regmap, and they will be moved to a separate file shared for both arm and aarch64 in the following patch. gdb/gdbserver: 2015-07-30 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c: Include arch/arm.h. (arm_fill_gregset): Don't use arm_num_regs and arm_regmap. (arm_store_gregset): Likewise.
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/linux-arm-low.c22
2 files changed, 20 insertions, 8 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 2e039b5479e..a3c0a2a0c63 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-30 Yao Qi <yao.qi@linaro.org>
+
+ * linux-arm-low.c: Include arch/arm.h.
+ (arm_fill_gregset): Don't use arm_num_regs and arm_regmap.
+ (arm_store_gregset): Likewise.
+
2015-07-29 Simon Marchi <simon.marchi@ericsson.com>
* linux-mips-low.c (mips_linux_prepare_to_resume): Add NULL as
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 14c96a3fcb0..0a343798a8f 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -18,6 +18,7 @@
#include "server.h"
#include "linux-low.h"
+#include "arch/arm.h"
/* Don't include elf.h if linux/elf.h got included by gdb_proc_service.h.
On Bionic elf.h and linux/elf.h have conflicting definitions. */
@@ -154,10 +155,12 @@ static void
arm_fill_gregset (struct regcache *regcache, void *buf)
{
int i;
+ uint32_t *regs = buf;
- for (i = 0; i < arm_num_regs; i++)
- if (arm_regmap[i] != -1)
- collect_register (regcache, i, ((char *) buf) + arm_regmap[i]);
+ for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
+ collect_register (regcache, i, &regs[i]);
+
+ collect_register (regcache, ARM_PS_REGNUM, &regs[16]);
}
static void
@@ -165,13 +168,16 @@ arm_store_gregset (struct regcache *regcache, const void *buf)
{
int i;
char zerobuf[8];
+ const uint32_t *regs = buf;
memset (zerobuf, 0, 8);
- for (i = 0; i < arm_num_regs; i++)
- if (arm_regmap[i] != -1)
- supply_register (regcache, i, ((char *) buf) + arm_regmap[i]);
- else
- supply_register (regcache, i, zerobuf);
+ for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
+ supply_register (regcache, i, &regs[i]);
+
+ for (; i < ARM_PS_REGNUM; i++)
+ supply_register (regcache, i, zerobuf);
+
+ supply_register (regcache, ARM_PS_REGNUM, &regs[16]);
}
static void