From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/6] Fetch and store VFP registers by PTRACE_{G,S}ETREGSET
Date: Thu, 28 May 2015 14:20:00 -0000 [thread overview]
Message-ID: <1432822816-32327-7-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1432822816-32327-1-git-send-email-yao.qi@linaro.org>
This patch is to use PTRACE_{G,S}ETREGSET to fetch and store VFP
registers if kernel supports.
gdb:
2015-05-28 Yao Qi <yao.qi@linaro.org>
* arm-linux-nat.c (fetch_vfp_regs): Use PTRACE_GETREGSET.
(store_vfp_regs): Use PTRACE_SETREGSET.
---
gdb/arm-linux-nat.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index b74767c..dd24ef6 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 == 1)
+ {
+ 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 == 1)
+ {
+ 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 == 1)
+ {
+ 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)
{
--
1.9.1
next prev parent reply other threads:[~2015-05-28 14:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 14:20 [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Yao Qi
2015-05-28 14:20 ` [PATCH 5/6] Fetch and store FP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 14:20 ` [PATCH 1/6] Move PTRACE_GETREGSET and PTRACE_SETREGSET to nat/linux-ptrace.h Yao Qi
2015-05-28 14:20 ` [PATCH 4/6] Fetch and store GP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 18:50 ` Doug Evans
2015-05-29 13:11 ` Yao Qi
2015-05-28 14:20 ` Yao Qi [this message]
2015-05-28 14:20 ` [PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET Yao Qi
2015-05-28 14:20 ` [PATCH 2/6] Move have_ptrace_getregset to linux-nat.c Yao Qi
2015-05-29 8:10 ` [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Gary Benson
2015-06-01 11:17 ` Yao Qi
2015-06-02 7:57 ` Mark Wielaard
2015-06-02 9:30 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432822816-32327-7-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).