aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-tdep.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-11-11 11:55:08 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-11-11 11:55:08 +0000
commit550820e16d0a1f44ee63086b1a2d931e04839ffa (patch)
tree8cab9812e2a3868d92c1b5cce445ee0dc8299344 /gdb/riscv-tdep.c
parent81fdd7acec68476bc23dd1ed4b2c6288aebe4343 (diff)
downloadgdb-550820e16d0a1f44ee63086b1a2d931e04839ffa.zip
gdb-550820e16d0a1f44ee63086b1a2d931e04839ffa.tar.gz
gdb-550820e16d0a1f44ee63086b1a2d931e04839ffa.tar.bz2
gdb/riscv: add ability to decode dwarf CSR numbers
Extends riscv_dwarf_reg_to_regnum to add the ability to convert the DWARF register numbers for CSRs into GDB's internal numbers. gdb/ChangeLog: * riscv-tdep.c (riscv_dwarf_reg_to_regnum): Decode DWARF CSR numbers. * riscv-tdep.h (RISCV_DWARF_FIRST_CSR, RISCV_DWARF_LAST_CSR): New enum values.
Diffstat (limited to 'gdb/riscv-tdep.c')
-rw-r--r--gdb/riscv-tdep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index e2270aa..4e25505 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -3150,6 +3150,9 @@ riscv_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
else if (reg < RISCV_DWARF_REGNUM_F31)
return RISCV_FIRST_FP_REGNUM + (reg - RISCV_DWARF_REGNUM_F0);
+ else if (reg >= RISCV_DWARF_FIRST_CSR && reg <= RISCV_DWARF_LAST_CSR)
+ return RISCV_FIRST_CSR_REGNUM + (reg - RISCV_DWARF_FIRST_CSR);
+
return -1;
}