qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 02/10] gdbstub: Clarify no more than @gdb_num_core_regs ca


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 02/10] gdbstub: Clarify no more than @gdb_num_core_regs can be accessed
Date: Wed, 22 Jan 2025 10:32:43 +0100
User-agent: Mozilla Thunderbird

On 22/1/25 10:30, Philippe Mathieu-Daudé wrote:
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 tricore implementations.

s/tricore/openrisc/ 🤦


Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  include/hw/core/cpu.h       | 2 ++
  target/microblaze/gdbstub.c | 5 -----
  target/openrisc/gdbstub.c   | 5 -----
  3 files changed, 2 insertions(+), 10 deletions(-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]