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.
This commit is contained in:
Yao Qi 2015-06-01 12:13:02 +01:00
parent df9d7ec9e7
commit bd16da5114
2 changed files with 37 additions and 3 deletions

View 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.

View 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);
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);
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,6 +651,15 @@ store_vfp_regs (const struct regcache *regcache)
regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
(char *) regbuf + 32 * 8);
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)