This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fetch and store VFP registers by PTRACE_{G,S}ETREGSET
- From: Yao Qi <qiyao at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 1 Jun 2015 11:17:48 -0000
- Subject: [binutils-gdb] Fetch and store VFP registers by PTRACE_{G,S}ETREGSET
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd16da5114e2f04772bf05604a608fbe006a485a
commit bd16da5114e2f04772bf05604a608fbe006a485a
Author: Yao Qi <yao.qi@linaro.org>
Date: Mon Jun 1 12:13:02 2015 +0100
Fetch and store VFP registers by PTRACE_{G,S}ETREGSET
This patch is to use PTRACE_{G,S}ETREGSET to fetch and store VFP
registers if kernel supports.
gdb:
2015-06-01 Yao Qi <yao.qi@linaro.org>
* arm-linux-nat.c (fetch_vfp_regs): Use PTRACE_GETREGSET.
(store_vfp_regs): Use PTRACE_SETREGSET.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/arm-linux-nat.c | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 646404f..0cfbd0d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2015-06-01 Yao Qi <yao.qi@linaro.org>
+ * arm-linux-nat.c (fetch_vfp_regs): Use PTRACE_GETREGSET.
+ (store_vfp_regs): Use PTRACE_SETREGSET.
+
+2015-06-01 Yao Qi <yao.qi@linaro.org>
+
* arm-linux-nat.c (fetch_fpregister): Use PTRACE_GETREGSET.
(fetch_fpregs): Likewise.
* arm-linux-nat.c (store_fpregister): Use PTRACE_SETREGSET.
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 2336845..b18d443 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -591,7 +591,17 @@ fetch_vfp_regs (struct regcache *regcache)
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
- ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
+ if (have_ptrace_getregset)
+ {
+ struct iovec iov;
+
+ iov.iov_base = regbuf;
+ iov.iov_len = VFP_REGS_SIZE;
+ ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iov);
+ }
+ else
+ ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
+
if (ret < 0)
{
warning (_("Unable to fetch VFP registers."));
@@ -617,7 +627,17 @@ store_vfp_regs (const struct regcache *regcache)
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
- ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
+ if (have_ptrace_getregset)
+ {
+ struct iovec iov;
+
+ iov.iov_base = regbuf;
+ iov.iov_len = VFP_REGS_SIZE;
+ ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iov);
+ }
+ else
+ ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
+
if (ret < 0)
{
warning (_("Unable to fetch VFP registers (for update)."));
@@ -631,7 +651,16 @@ store_vfp_regs (const struct regcache *regcache)
regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
(char *) regbuf + 32 * 8);
- ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
+ if (have_ptrace_getregset)
+ {
+ struct iovec iov;
+
+ iov.iov_base = regbuf;
+ iov.iov_len = VFP_REGS_SIZE;
+ ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_VFP, &iov);
+ }
+ else
+ ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
if (ret < 0)
{