On 10/3/26 16:53, Philippe Mathieu-Daudé wrote:
When a feature XML file provides a "regnum=" tag to indicate the registers base index, respect it, as it might not be the same as our current number of registered entries, in particular when there are gaps.This fixes a bug with the "power-fpu.xml" file [*] which was loaded at index 70 while the base register is 71. This latent bug was exposed by commit 1ec0fbe2dda ("target/ppc: Fix CPUClass::gdb_num_core_regs value"). [*] https://lore.kernel.org/qemu-devel/[email protected]/ Reported-by: Florian Hofhammer <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- gdbstub/gdbstub.c | 16 ++++++++++------ gdbstub/trace-events | 1 + 2 files changed, 11 insertions(+), 6 deletions(-)
@@ -617,7 +618,6 @@ void gdb_register_coprocessor(CPUState *cpu, { GDBRegisterState *s; guint i; - int base_reg = cpu->gdb_num_regs;for (i = 0; i < cpu->gdb_regs->len; i++) {/* Check for duplicates. */ @@ -627,7 +627,11 @@ void gdb_register_coprocessor(CPUState *cpu, } }- gdb_register_feature(cpu, base_reg, get_reg, set_reg, feature);+ if (cpu->gdb_num_regs < feature->base_reg) { + trace_gdbxml_register_coprocessor_gap(cpu->gdb_num_regs, + feature->base_reg); + } + gdb_register_feature(cpu, get_reg, set_reg, feature);
Broken patch, please disregard.
