gdb/riscv: Use correct regnum in riscv_linux_nat_target::fetch_registers
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 25 Oct 2018 11:03:31 +0000 (12:03 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 25 Oct 2018 11:03:31 +0000 (12:03 +0100)
In riscv_linux_nat_target::fetch_registers, if we are asked to supply
all registers (regnum parameter is -1), then we currently end up
calling regcache::raw_supply_zeroed with the regnum -1, which is
invalid.  Instead we should be passing the regnum of the specific
register we wish to supply zeroed, in this case RISCV_CSR_MISA_REGNUM.

I removed the extra { ... } block in line with the coding standard
while editing this area.

gdb/ChangeLog:

* riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
Pass correct regnum to raw_supply_zeroed.

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

index ba3bf66db87a2c721baffcbe886878f8977ad5d8..14de366cfcd2af0bae5b7e6852cfe78ab0e0c77b 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-25  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
+       Pass correct regnum to raw_supply_zeroed.
+
 2018-10-23  Hafiz Abid Qadeer  <abidh@codesourcery.com>
 
        * regcache.c (cooked_read_test): Add CSKY to the list of
index 7dbfe651f2c77a86d126a47685cbd5162d5ff9e5..c09121d052b662fcee27fed559ec1a3608d5388a 100644 (file)
@@ -201,10 +201,8 @@ riscv_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 
   if ((regnum == RISCV_CSR_MISA_REGNUM)
       || (regnum == -1))
-    {
-      /* TODO: Need to add a ptrace call for this.  */
-      regcache->raw_supply_zeroed (regnum);
-    }
+    /* TODO: Need to add a ptrace call for this.  */
+    regcache->raw_supply_zeroed (RISCV_CSR_MISA_REGNUM);
 
   /* Access to other CSRs has potential security issues, don't support them for
      now.  */
This page took 0.031765 seconds and 4 git commands to generate.