aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-tdep.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-11-26 11:42:03 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-12-02 17:47:39 +0000
commit533b2ae07d0437d0f9ae26f2067c1eab7999c5ba (patch)
tree73fdeb12afd0ff7975a9a1aa0dccb0b41b2c26fd /gdb/riscv-tdep.c
parente45020422076c1014579ae8763fd253990ddf58e (diff)
downloadgdb-533b2ae07d0437d0f9ae26f2067c1eab7999c5ba.zip
gdb-533b2ae07d0437d0f9ae26f2067c1eab7999c5ba.tar.gz
gdb-533b2ae07d0437d0f9ae26f2067c1eab7999c5ba.tar.bz2
gdb/riscv: remove csr aliases created with DECLARE_CSR_ALIAS
In this commit: commit 767a879e31ce31179e6135c2f991f670a35709fa Date: Tue Jun 9 17:38:30 2020 +0100 gdb/riscv: Improved register alias name creation RISC-V GDB was changed to make use of the DECLARE_CSR_ALIAS macro to define register aliases for some CSRs. Actually, only one alias was created 'dscratch' as an alias for 'dscratch0'. All of the other DECLARE_CSR_ALIAS lines (from include/opcode/riscv-opc.h) were filtered out. In this commit: commit 08ccfccf0ed825be9be2972594d4be4a2207ef13 Date: Mon Jun 8 10:54:53 2020 +0800 RISC-V: Support debug and float CSR as the unprivileged ones. Changes were made to include/opcode/riscv-opc.h so that GDB no longer created even the dscratch alias. This caused a test failure in gdb.arch/riscv-tdesc-regs.exp. In looking at how to address this failure I think that the best strategy is, for now at least, to just remove the code that tries to create aliases with DECLARE_CSR_ALIAS. My thoughts are that: 1. At least some of the aliases are for CSRs where the register now has a completely different use. Being able to reference the CSR using a completely inappropriate name just seems confusing. This was solved by the filtering added in the first commit referenced above. But we certainly don't want to blindly add all aliases. 2. Names presented in a target description are always honoured, so if a user has a legacy target then they should just start sending a target description with their legacy register names in, this problem is then solved. 3. It's easy enough to figure out which CSRs a target has with the info registers command, so missing an alias shouldn't be a big issue. 4. Allowing users to use names for registers that differ from the names the target announces doesn't feel like a critical feature. If in the future targets want multiple names for a register then maybe we could/should extend target descriptions to allow the target to send aliases as well as the primary name.... but that can wait for another day. So in this commit I remove the use of DECLARE_CSR_ALIAS, and remove the test that was failing. gdb/ChangeLog: * riscv-tdep.c (riscv_create_csr_aliases): Remove use of DECLARE_CSR_ALIAS. gdb/testsuite/ChangeLog: * gdb.arch/riscv-tdesc-regs.exp: Remove unwanted test.
Diffstat (limited to 'gdb/riscv-tdep.c')
-rw-r--r--gdb/riscv-tdep.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 437e8f8..2f182e8 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -376,16 +376,6 @@ riscv_create_csr_aliases ()
int csr_num = reg.regnum - RISCV_FIRST_CSR_REGNUM;
const char *alias = xstrprintf ("csr%d", csr_num);
reg.names.push_back (alias);
-
- /* Setup the other csr aliases. We don't use a switch table here in
- case there are multiple aliases with the same value. Also filter
- based on ABRT_VER in order to avoid a very old alias for misa that
- duplicates the name "misa" but at a different CSR address. */
-#define DECLARE_CSR_ALIAS(NAME,VALUE,CLASS,DEF_VER,ABRT_VER) \
- if (csr_num == VALUE && ABRT_VER >= PRIV_SPEC_CLASS_1P11) \
- reg.names.push_back ( # NAME );
-#include "opcode/riscv-opc.h"
-#undef DECLARE_CSR_ALIAS
}
}