From patchwork Tue Jul 25 09:05:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 21751 Received: (qmail 104561 invoked by alias); 25 Jul 2017 09:05:46 -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 99142 invoked by uid 89); 25 Jul 2017 09:05:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:static. X-HELO: mail-it0-f67.google.com Received: from mail-it0-f67.google.com (HELO mail-it0-f67.google.com) (209.85.214.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Jul 2017 09:05:41 +0000 Received: by mail-it0-f67.google.com with SMTP id r9so8335754ita.3 for ; Tue, 25 Jul 2017 02:05:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=ECZ3AGpneVmPw3CCk+iGe9ugZ1GhfNwH+ukH5FPpneI=; b=kSS0nBGGGhwrumhg4Sh6UxopyvQe4DZ6Bp3tZ5eTA1/ydHe2STjOFc+8ALQESwrr73 P4B2KcRxgvUXXtKSx65womRvoeg9zIf8dN0P2cItbbfE7czhEaotOV76Hg7rDwXQH6hq wof4aw9kVndholhjIgFKywU5SrD384fFWa+dqk/qFI0TIl5t/4JLyJD5vAlPLM2dwsO5 AAUszWXl1l35tfz97QFquKYzjLjmeHLfihCNuflQPpdhXICQqAjPUKLc5jkiGSP2QyUB TdFc4GGRI3mazYeXO932K5eXGqvpNEp1MPFEYBtVjiq0zU8EOl/NgpuOTILQsB13RGTN G9og== X-Gm-Message-State: AIVw110Q6u1aYbEkpZcT8NYnw3a7aIaYfqlNug3AHLW10xlfG///EuAe n187phMWnj9u2Y/k X-Received: by 10.36.103.203 with SMTP id u194mr2040984itc.27.1500973539430; Tue, 25 Jul 2017 02:05:39 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id f1sm6756182ioe.80.2017.07.25.02.05.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 02:05:38 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] [ARM] Access FPSCR on vfpv2 Date: Tue, 25 Jul 2017 10:05:32 +0100 Message-Id: <1500973532-7116-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes GDB can fetch or store FPSCR on vfpv3, which has 32 VFP registers, but fail to do so on vfpv2, which has 16 VFP registers. GDB code is incorrect for vfpv2, else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) while FPSCR register number is defined as ARM_D0_REGNUM + 32. ARM_D0_REGNUM, /* VFP double-precision registers. */ ARM_D31_REGNUM = ARM_D0_REGNUM + 31, ARM_FPSCR_REGNUM, The code above uses "<=" rather than "<", in order to put FPSCR in the range, but it is only correct when tdep->vfp_register_count is 32. On vpfv2, it is 16, and FPSCR is out of the range, so fetch_vfp_regs or store_vfp_regs are not called. gdb: 2017-07-25 Yao Qi PR tdep/21717 * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update condition for FPSCR. (arm_linux_store_inferior_registers): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/arm-linux-nat.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8944833..eb49001 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2017-07-25 Yao Qi + + PR tdep/21717 + * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update + condition for FPSCR. + (arm_linux_store_inferior_registers): Likewise. + 2017-07-22 Tom Tromey * break-catch-syscall.c (struct catch_syscall_inferior_data) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index ad3085a..4039d1e 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -402,7 +402,8 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, fetch_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM - && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) + && (regno < ARM_D0_REGNUM + tdep->vfp_register_count + || regno == ARM_FPSCR_REGNUM)) fetch_vfp_regs (regcache); } } @@ -439,7 +440,8 @@ arm_linux_store_inferior_registers (struct target_ops *ops, store_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM - && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) + && (regno < ARM_D0_REGNUM + tdep->vfp_register_count + || regno == ARM_FPSCR_REGNUM)) store_vfp_regs (regcache); } }