gdb/riscv: place unknown csrs into the correct register groups
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 24 Nov 2020 18:08:25 +0000 (18:08 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 2 Dec 2020 17:47:39 +0000 (17:47 +0000)
commite45020422076c1014579ae8763fd253990ddf58e
treec1738488ba31f78c02c69ca5b5603e32efb82f9f
parent7ddfb1a891ce2fee8708e6d5f14a6935d307875e
gdb/riscv: place unknown csrs into the correct register groups

Unknown riscv CSRs should not be in the 'general' group, but should be
in the system and csr register groups.

To see this in action connect to QEMU, this target advertises two
registers dscratch and mucounteren which are unknown to GDB (these are
legacy CSRs).  Before this commit these registers would show up in the
output of:

  (gdb) info registers
  ....
  dscratch       Could not fetch register "dscratch"; remote failure reply 'E14'
  mucounteren    Could not fetch register "mucounteren"; remote failure reply 'E14'

Ignore the errors, this is just a QEMU annoyance, it advertises these
CSRs, but doesn't actually let GDB read them.  These registers don't
show up in the output of either:

  (gdb) info registers csr
  (gdb) info registers system

After this commit this situation is reveresed, which makes more sense
to me.

gdb/ChangeLog:

* 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
CSRs.

gdb/testsuite/ChangeLog:

* gdb.arch/riscv-tdesc-regs.exp (get_expected_result): New proc,
update test to use this.
gdb/ChangeLog
gdb/riscv-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
This page took 0.042987 seconds and 4 git commands to generate.