aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
parente45020422076c1014579ae8763fd253990ddf58e (diff)
downloadfsf-binutils-gdb-533b2ae07d0437d0f9ae26f2067c1eab7999c5ba.zip
fsf-binutils-gdb-533b2ae07d0437d0f9ae26f2067c1eab7999c5ba.tar.gz
fsf-binutils-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')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/riscv-tdep.c10
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp4
4 files changed, 9 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1d5bbcf..fdda913 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-12-02 Andrew Burgess <andrew.burgess@embecosm.com>
+ * riscv-tdep.c (riscv_create_csr_aliases): Remove use of
+ DECLARE_CSR_ALIAS.
+
+2020-12-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
* riscv-tdep.c (riscv_is_unknown_csr): New function,
implementation moved from riscv_register_reggroup_p.
(riscv_register_reggroup_p): Update group handling for unknown
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
}
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f093845..c00bc61 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-12-02 Andrew Burgess <andrew.burgess@embecosm.com>
+ * gdb.arch/riscv-tdesc-regs.exp: Remove unwanted test.
+
+2020-12-02 Andrew Burgess <andrew.burgess@embecosm.com>
+
* gdb.arch/riscv-tdesc-regs.exp (get_expected_result): New proc,
update test to use this.
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
index e35d618..6ee2bb7 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
@@ -76,10 +76,6 @@ gdb_test_no_output "set tdesc filename $remote_file" \
# Check that an alias for an unknown CSR will give a suitable error.
gdb_test "info registers \$csr0" "Invalid register `csr0'"
-# Check we can access the dscratch register using either of its names.
-gdb_test "info registers \$dscratch0" "dscratch0\[ \t\]+.*"
-gdb_test "info registers \$dscratch" "dscratch\[ \t\]+.*"
-
# Return the number of times REGISTER should appear in GROUP, this
# will either be 0 or 1.
proc get_expected_result { register group } {