diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-07-07 16:58:19 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-07-07 16:58:19 +0100 |
commit | f1b6788884b2e95105475c95b7f22f6ceba2271e (patch) | |
tree | 48eb513f7c6a68d69058b9dfe7354bc029266ed1 /gdb/arm-linux-nat.c | |
parent | 179bfe826ba62ca8aa43f3d20cc1b21dfc41b1d0 (diff) | |
download | gdb-f1b6788884b2e95105475c95b7f22f6ceba2271e.zip gdb-f1b6788884b2e95105475c95b7f22f6ceba2271e.tar.gz gdb-f1b6788884b2e95105475c95b7f22f6ceba2271e.tar.bz2 |
New aarch32-linux-nat.c
This patch is to move all the code about transferring
regcache <-> byte buffer for arm (aarch32) to a separate file
aarch32-linux-nat.c. Then, in the following patch, aarch64 code
can use it to do multi-arch debugging. This is a refactory patch.
gdb:
2015-07-07 Yao Qi <yao.qi@linaro.org>
* aarch32-linux-nat.c: New file.
* aarch32-linux-nat.h: New file.
* arm-linux-nat.c: Include aarch32-linux-nat.h.
(fetch_regs): Move code to aarch32-linux-nat.c. Call
aarch32_gp_regcache_supply.
(store_regs): Move code to aarch32-linux-nat.c. Call
aarch32_gp_regcache_collect.
(fetch_vfp_regs): Move code to aarch32-linux-nat.c. Call
aarch32_vfp_regcache_supply.
(store_vfp_regs): Move code to aarch32-linux-nat.c. Call
aarch32_vfp_regcache_collect.
* config/arm/linux.mh (NATDEPFILES): Add aarch32-linux-nat.o.
Diffstat (limited to 'gdb/arm-linux-nat.c')
-rw-r--r-- | gdb/arm-linux-nat.c | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 5a8880f..aca0461 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -29,6 +29,7 @@ #include "arm-tdep.h" #include "arm-linux-tdep.h" +#include "aarch32-linux-nat.h" #include <elf/common.h> #include <sys/user.h> @@ -212,20 +213,7 @@ fetch_regs (struct regcache *regcache) return; } - for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++) - regcache_raw_supply (regcache, regno, (char *) ®s[regno]); - - if (arm_apcs_32) - regcache_raw_supply (regcache, ARM_PS_REGNUM, - (char *) ®s[ARM_CPSR_GREGNUM]); - else - regcache_raw_supply (regcache, ARM_PS_REGNUM, - (char *) ®s[ARM_PC_REGNUM]); - - regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove - (get_regcache_arch (regcache), regs[ARM_PC_REGNUM]); - regcache_raw_supply (regcache, ARM_PC_REGNUM, - (char *) ®s[ARM_PC_REGNUM]); + aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, arm_apcs_32); } static void @@ -256,15 +244,7 @@ store_regs (const struct regcache *regcache) return; } - for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++) - { - if (REG_VALID == regcache_register_status (regcache, regno)) - regcache_raw_collect (regcache, regno, (char *) ®s[regno]); - } - - if (arm_apcs_32 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM)) - regcache_raw_collect (regcache, ARM_PS_REGNUM, - (char *) ®s[ARM_CPSR_GREGNUM]); + aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, arm_apcs_32); if (have_ptrace_getregset == TRIBOOL_TRUE) { @@ -370,7 +350,7 @@ store_wmmx_regs (const struct regcache *regcache) static void fetch_vfp_regs (struct regcache *regcache) { - char regbuf[VFP_REGS_SIZE]; + gdb_byte regbuf[VFP_REGS_SIZE]; int ret, regno, tid; struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -395,18 +375,14 @@ fetch_vfp_regs (struct regcache *regcache) return; } - for (regno = 0; regno < tdep->vfp_register_count; regno++) - regcache_raw_supply (regcache, regno + ARM_D0_REGNUM, - (char *) regbuf + regno * 8); - - regcache_raw_supply (regcache, ARM_FPSCR_REGNUM, - (char *) regbuf + 32 * 8); + aarch32_vfp_regcache_supply (regcache, regbuf, + tdep->vfp_register_count); } static void store_vfp_regs (const struct regcache *regcache) { - char regbuf[VFP_REGS_SIZE]; + gdb_byte regbuf[VFP_REGS_SIZE]; int ret, regno, tid; struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -431,12 +407,8 @@ store_vfp_regs (const struct regcache *regcache) return; } - for (regno = 0; regno < tdep->vfp_register_count; regno++) - regcache_raw_collect (regcache, regno + ARM_D0_REGNUM, - (char *) regbuf + regno * 8); - - regcache_raw_collect (regcache, ARM_FPSCR_REGNUM, - (char *) regbuf + 32 * 8); + aarch32_vfp_regcache_collect (regcache, regbuf, + tdep->vfp_register_count); if (have_ptrace_getregset == TRIBOOL_TRUE) { |