diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-10-23 13:23:34 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-10-23 13:27:56 +0100 |
commit | 420ecd9ce8a3d61f950bf24d8d7b8827d09f59db (patch) | |
tree | fab01bf08d413b694647718196edaa8056bb4319 /gdb | |
parent | 45a0eaf77022963d639d6d19871dbab7b79703fc (diff) | |
download | gdb-420ecd9ce8a3d61f950bf24d8d7b8827d09f59db.zip gdb-420ecd9ce8a3d61f950bf24d8d7b8827d09f59db.tar.gz gdb-420ecd9ce8a3d61f950bf24d8d7b8827d09f59db.tar.bz2 |
gdb/riscv: Give user-friendly names for CSRs
The recent commit:
commit 0dbfcfffe9abbc5198bce95eb8c66b6bc9b364be
Date: Tue Oct 16 22:40:09 2018 +0100
gdb/riscv: Fix register access for register aliases
broke the CSR names for RISC-V, now all of the CSRs have names like,
csr0, csr1, csr2, etc. This commit restores the previous
user-friendly names.
gdb/ChangeLog:
* riscv-tdep.c (riscv_register_name): Use the user-friendly names
for CSRs.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/riscv-tdep.c | 19 |
2 files changed, 20 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 88d76db..db4c6b1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-10-23 Andrew Burgess <andrew.burgess@embecosm.com> + + * riscv-tdep.c (riscv_register_name): Use the user-friendly names + for CSRs. + 2018-10-23 Joel Brobecker <brobecker@adacore.com> * riscv-tdep.c (riscv_gdbarch_init): Set the gdbarch's diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 48ca2ac..f02420d 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -482,11 +482,22 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum) if (regnum >= RISCV_FIRST_CSR_REGNUM && regnum <= RISCV_LAST_CSR_REGNUM) { - static char buf[20]; +#define DECLARE_CSR(NAME,VALUE) \ + case RISCV_ ## VALUE ## _REGNUM: return # NAME; - xsnprintf (buf, sizeof (buf), "csr%d", - regnum - RISCV_FIRST_CSR_REGNUM); - return buf; + switch (regnum) + { + #include "opcode/riscv-opc.h" + default: + { + static char buf[20]; + + xsnprintf (buf, sizeof (buf), "csr%d", + regnum - RISCV_FIRST_CSR_REGNUM); + return buf; + } + } +#undef DECLARE_CSR } if (regnum == RISCV_PRIV_REGNUM) |