On 2/27/26 1:39 PM, Philippe Mathieu-Daudé wrote:
gdb_register_coprocessor()'s @g_pos argument is always '0',
meaning it is inferred from cpu->gdb_num_regs. Use instead
feature->base_reg, but check we don't overwrite other indexed
registers.

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]>
---
  include/exec/gdbstub.h     |  3 +--
  gdbstub/gdbstub.c          | 16 +++++-----------
  target/arm/gdbstub.c       | 21 ++++++++-------------
  target/arm/gdbstub64.c     | 19 +++++++------------
  target/hexagon/cpu.c       |  2 +-
  target/i386/gdbstub.c      |  8 +++-----
  target/loongarch/gdbstub.c |  6 +++---
  target/m68k/helper.c       |  4 ++--
  target/microblaze/cpu.c    |  3 +--
  target/ppc/gdbstub.c       | 11 +++++------
  target/riscv/gdbstub.c     | 18 ++++++------------
  target/s390x/gdbstub.c     | 15 +++++++--------
  target/sparc/gdbstub.c     | 12 ++++--------
  13 files changed, 53 insertions(+), 85 deletions(-)


Reviewed-by: Pierrick Bouvier <[email protected]>

Reply via email to