From patchwork Thu May 28 14:20:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 6957 Received: (qmail 107037 invoked by alias); 28 May 2015 14:20:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106926 invoked by uid 89); 28 May 2015 14:20:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 28 May 2015 14:20:33 +0000 Received: by padbw4 with SMTP id bw4so24622147pad.0 for ; Thu, 28 May 2015 07:20:31 -0700 (PDT) X-Received: by 10.68.89.100 with SMTP id bn4mr6083422pbb.48.1432822831345; Thu, 28 May 2015 07:20:31 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id dd3sm2587101pad.45.2015.05.28.07.20.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 07:20:30 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 6/6] Fetch and store VFP registers by PTRACE_{G,S}ETREGSET Date: Thu, 28 May 2015 15:20:16 +0100 Message-Id: <1432822816-32327-7-git-send-email-yao.qi@linaro.org> In-Reply-To: <1432822816-32327-1-git-send-email-yao.qi@linaro.org> References: <1432822816-32327-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes This patch is to use PTRACE_{G,S}ETREGSET to fetch and store VFP registers if kernel supports. gdb: 2015-05-28 Yao Qi * 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) {