mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
gdbstub: Clarify no more than @gdb_num_core_regs can be accessed
Both CPUClass::gdb_read_register() and CPUClass::gdb_write_register() handlers are called from common gdbstub code, and won't be called with register index over CPUClass::gdb_num_core_regs: int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu); if (reg < cc->gdb_num_core_regs) { return cc->gdb_read_register(cpu, buf, reg); } ... } static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { CPUClass *cc = CPU_GET_CLASS(cpu); if (reg < cc->gdb_num_core_regs) { return cc->gdb_write_register(cpu, mem_buf, reg); } ... } Clarify that in CPUClass docstring, and remove unreachable code on the microblaze and openrisc implementations. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250122093028.52416-3-philmd@linaro.org>
This commit is contained in:
parent
82c4d8a3b4
commit
46a2cfc448
3 changed files with 2 additions and 10 deletions
|
@ -124,7 +124,9 @@ struct SysemuCPUOps;
|
|||
* @get_pc: Callback for getting the Program Counter register.
|
||||
* As above, with the semantics of the target architecture.
|
||||
* @gdb_read_register: Callback for letting GDB read a register.
|
||||
* No more than @gdb_num_core_regs registers can be read.
|
||||
* @gdb_write_register: Callback for letting GDB write a register.
|
||||
* No more than @gdb_num_core_regs registers can be written.
|
||||
* @gdb_adjust_breakpoint: Callback for adjusting the address of a
|
||||
* breakpoint. Used by AVR to handle a gdb mis-feature with
|
||||
* its Harvard architecture split code and data.
|
||||
|
|
|
@ -110,14 +110,9 @@ int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByteArray *mem_buf, int n)
|
|||
|
||||
int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||
CPUMBState *env = cpu_env(cs);
|
||||
uint32_t tmp;
|
||||
|
||||
if (n > cc->gdb_num_core_regs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmp = ldl_p(mem_buf);
|
||||
|
||||
switch (n) {
|
||||
|
|
|
@ -47,14 +47,9 @@ int openrisc_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
|||
|
||||
int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||
CPUOpenRISCState *env = cpu_env(cs);
|
||||
uint32_t tmp;
|
||||
|
||||
if (n > cc->gdb_num_core_regs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmp = ldl_p(mem_buf);
|
||||
|
||||
if (n < 32) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue