Fetch and store VFP registers by PTRACE_{G,S}ETREGSET
authorYao Qi <yao.qi@linaro.org>
Mon, 1 Jun 2015 11:13:02 +0000 (12:13 +0100)
committerYao Qi <yao.qi@linaro.org>
Mon, 1 Jun 2015 11:13:02 +0000 (12:13 +0100)
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.

gdb/ChangeLog
gdb/arm-linux-nat.c

index 646404f81bac4273c830b85335baa81aebc28505..0cfbd0d587b2c539a930779bb07b484c1f89bd88 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 2336845303e4ff44b9fc195cc6048ceb20835acc..b18d4437219bdf0e9e901872c742a0db4ce0d612 100644 (file)
@@ -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)
     {
This page took 0.028025 seconds and 4 git commands to generate.