aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc/gdb.texinfo
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-04 18:34:13 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-24 16:06:54 +0000
commit895b7b4e4bed9eee9d4a3d55bee876055736bfd3 (patch)
tree99f835d6b88ce3dd716e62b17f26f0ea58d25812 /gdb/doc/gdb.texinfo
parentbc3c0632a2ebec04ad8c3c320dc8e9852bd2aabe (diff)
downloadgdb-895b7b4e4bed9eee9d4a3d55bee876055736bfd3.zip
gdb-895b7b4e4bed9eee9d4a3d55bee876055736bfd3.tar.gz
gdb-895b7b4e4bed9eee9d4a3d55bee876055736bfd3.tar.bz2
gdb/riscv: select rv32 target by default when requested
GDB for RISC-V always uses target descriptions. When the target doesn't provide a target description then a default is selected. Usually this default is selected based on the properties of the executable being debugged. However, when there is no executable being debugged we currently fallback to the riscv:rv64 target description as the default. This leads to strange behaviour like this: $ gdb (gdb) set architecture riscv:rv32 (gdb) p sizeof ($pc) $1 = 8 Despite the users specifically setting the architecture to riscv:rv32 GDB still thinks that the target has riscv:rv64 register sizes. The above is a bit of a contrived situation. I actually ran into this situation while trying to connect to a running riscv:rv32 target without supplying an executable (the target didn't provide a target description). When I tried to set a register on the target I ran into errors because GDB was passing 8 bytes to the target rather than the expected 4. Even when I manually specified the architecture (as above) I couldn't convince GDB to only send 4 bytes. This patch fixes this issue. Now, when we selected a default target description we will make use of the user selected architecture to guide our choice. In the above example we now get: $ gdb (gdb) set architecture riscv:rv32 (gdb) p sizeof ($pc) $1 = 4 And my real world example of connecting to a remote without an executable works fine. I've used the fact that we can ask GDB about $pc even when no executable is loaded as the basis for a test to cover this situation. gdb/ChangeLog: * riscv-tdep.c (riscv_features_from_gdbarch_info): Rename to... (riscv_features_from_bfd): ...this. Change parameter type to 'bfd*', and update as required. (riscv_find_default_target_description): Update call to riscv_features_from_bfd. Select a default xlen based on info.bfd_arch_info. (riscv_gdbarch_init): Update call to riscv_features_from_bfd. gdb/testsuite/ChangeLog: * gdb.arch/riscv-default-tdesc.exp: New file.
Diffstat (limited to 'gdb/doc/gdb.texinfo')
0 files changed, 0 insertions, 0 deletions