gdb: add a gdbarch_register_name self test, and fix some architectures
This commit adds a self-test that checks that gdbarch_register_name never returns nullptr for any valid register number. Most architectures already met this requirement, there were just 6 that failed the new selftest, and are updated in this commit. Beyond the self-tests I don't have any facilities to test that the architectures I've adjusted still work correctly. If you review all the various gdbarch_register_name implementations then you will see that there are far more architectures that seem like they might return nullptr in some situations, e.g. alpha, avr, bpf, etc. This commit doesn't attempt to address these cases as non of them are hit during the selftest. Many of these cases can never be hit, for example, in alpha_register_name GDB checks for a register number less than zero, this case can't happen and could be changed into an assert. A later commit in this series will have a general cleanup of all the various register_name methods, and remove all references to NULL from their code, however, as that commit will be mostly adjusting code that is never hit, I want to keep those changes separate. The selftest has been tested on x86-64, but I don't have access to suitable systems to fully test any of the *-tdep.c code I've changed in this commit.
This commit is contained in:
parent
89e601ac3a
commit
9a972b5404
7 changed files with 69 additions and 71 deletions
|
@ -757,14 +757,14 @@ mark_save_restore (struct m32c_reg *reg)
|
|||
/* A raw banked general-purpose data register named NAME.
|
||||
NAME should be an identifier, not a string. */
|
||||
#define RBD(name) \
|
||||
(R(NULL, tdep->int16, SIM (name ## _bank0)), \
|
||||
R(NULL, tdep->int16, SIM (name ## _bank1)) - 1)
|
||||
(R("", tdep->int16, SIM (name ## _bank0)), \
|
||||
R("", tdep->int16, SIM (name ## _bank1)) - 1)
|
||||
|
||||
/* A raw banked data address register named NAME.
|
||||
NAME should be an identifier, not a string. */
|
||||
#define RBA(name) \
|
||||
(R(NULL, tdep->data_addr_reg_type, SIM (name ## _bank0)), \
|
||||
R(NULL, tdep->data_addr_reg_type, SIM (name ## _bank1)) - 1)
|
||||
(R("", tdep->data_addr_reg_type, SIM (name ## _bank0)), \
|
||||
R("", tdep->data_addr_reg_type, SIM (name ## _bank1)) - 1)
|
||||
|
||||
/* A cooked register named NAME referring to a raw banked register
|
||||
from the bank selected by the current value of FLG. RAW_PAIR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue