]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[ARM] Access FPSCR on vfpv2
authorYao Qi <yao.qi@linaro.org>
Tue, 25 Jul 2017 09:15:25 +0000 (10:15 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 25 Jul 2017 09:15:25 +0000 (10:15 +0100)
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  <yao.qi@linaro.org>

PR tdep/21717
* arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update
condition for FPSCR.
(arm_linux_store_inferior_registers): Likewise.

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

index 283411d788db823cec9d3308481ade32865df5a2..11ff1c916561839097c15a398a922a59df067e58 100644 (file)
@@ -1,3 +1,10 @@
+2017-07-25  Yao Qi  <yao.qi@linaro.org>
+
+       PR tdep/21717
+       * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update
+       condition for FPSCR.
+       (arm_linux_store_inferior_registers): Likewise.
+
 2017-06-04  Joel Brobecker  <brobecker@adacore.com>
 
        * version.in: Set GDB version number to 8.0.0.DATE-git.
index ad3085a25c68b79485931e480bbb21a922aeebf3..4039d1e8d8bfef0329d59974a31fa8b3e8e77b74 100644 (file)
@@ -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);
     }
 }