gdb/riscv: Improve support for matching against target descriptions
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 16 Jun 2020 09:02:09 +0000 (10:02 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 25 Jun 2020 17:07:31 +0000 (18:07 +0100)
commit3b9fce9660539584e869ea2d77610434e6baa2a2
tree77a7d44329854da2186a0ab06610794864299c15
parent865bad2602bd212875063968ae429fca8f9190d1
gdb/riscv: Improve support for matching against target descriptions

For the RISC-V target it is desirable if the three floating pointer
status CSRs fflags, frm, and fcsr can be placed into either the FPU
feature or the CSR feature.  This allows different targets to build
the features in a way that better reflects their target.

The change to support this within GDB is fairly simple, so this is
done in this commit, and some tests added to check this new
functionality.

gdb/ChangeLog:

* riscv-tdep.c (value_of_riscv_user_reg): Moved to here from later
in the file.
(class riscv_pending_register_alias): Likewise.
(riscv_register_feature::register_info): Change 'required_p' field
to 'required', and change its type.  Add 'check' member function.
(riscv_register_feature::register_info::check): Define new member
function.
(riscv_xreg_feature): Change initialisation of 'required' field.
(riscv_freg_feature): Likewise.
(riscv_virtual_feature): Likewise.
(riscv_csr_feature): Likewise.
(riscv_check_tdesc_feature): Take extra parameter, the csr
tdesc_feature, rewrite the function to use the new
riscv_register_feature::register_info::check function.
(riscv_gdbarch_init): Pass the csr tdesc_feature where needed.

gdb/testsuite/ChangeLog:

* gdb.arch/riscv-tdesc-loading-01.xml: New file.
* gdb.arch/riscv-tdesc-loading-02.xml: New file.
* gdb.arch/riscv-tdesc-loading-03.xml: New file.
* gdb.arch/riscv-tdesc-loading-04.xml: New file.
* gdb.arch/riscv-tdesc-loading.exp: New file.
gdb/ChangeLog
gdb/riscv-tdep.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/riscv-tdesc-loading-01.xml [new file with mode: 0644]
gdb/testsuite/gdb.arch/riscv-tdesc-loading-02.xml [new file with mode: 0644]
gdb/testsuite/gdb.arch/riscv-tdesc-loading-03.xml [new file with mode: 0644]
gdb/testsuite/gdb.arch/riscv-tdesc-loading-04.xml [new file with mode: 0644]
gdb/testsuite/gdb.arch/riscv-tdesc-loading.exp [new file with mode: 0644]