Hi,
HMP monitor supports printing $register expression. The lookup
was done via GDB stub registers, and supplementary MonitorDef
HMP-specific tables.
Migrate HMP registers to use the GDB infrastructure and remove the
legacy HMP MonitorDef. Internal registers aren't exposed to GDB.
This also drops HMP $pc x86 fallback (use $eip/$rip instead).
Known behavioural changes on RISC-V: CSR lookup is now case-sensitive
and vector registers now report "unkown register" instead of a
target-specific message ("Unable to print the value of vector vreg 'v0'
from this API")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
Changes in v3:
- added x86 GDB register patches
- fix the x87 FPU tag word returned by the GDB stub
- split SSE registers into a separate org.gnu.gdb.i386.sse feature
- expose AVX/AVX-512 registers (ymm/zmm upper halves and opmask)
- expose more system registers to HMP
- renamed i386-segments.xml to i386-system.xml and registered it as an
internal feature, like the other targets
- moved the HMP $pc removal to its own patch and documented it in
removed-features.rst
- moved each target's MonitorDef removal into its target patch; the final
patch now only removes the generic MonitorDef infrastructure
- added MAINTAINERS entries
- rebased onto current master
- Link to v2: https://lore.kernel.org/qemu-devel/20261013-query-reg-v2-0-6f95a2e139a9@redhat.com
Changes in v2:
- dropped v1 patch 5 (CPUClass::get_pc fallback for $pc)
- new patch gdb_register_internal_coprocessor() to hide registers from GDB
- SPARC64, m68k, RISC-V aliases now use internal registration
- pickup trailer tags
- Link to v1: https://lore.kernel.org/qemu-devel/20260911-query-reg-v1-0-0c04f0c02cf3@redhat.com
---
Marc-André Lureau (18):
hmp: don't crash on invalid register
gdbstub: fix next register base after register gaps
gdbstub: set feature->base_reg for dynamic features
gdbstub: add gdb_register_internal_coprocessor()
MAINTAINERS: cover x86 GDB XML files
target/i386: expose segment limits register to monitors via gdbstub
target/i386: fix FPU tag word in GDB register read
target/i386: split SSE registers into separate GDB feature
target/i386: expose system registers to monitors via gdbstub
target/i386: expose AVX/AVX-512 registers to GDB
target/i386: drop HMP $pc
MAINTAINERS: cover m68k GDB XML files
target/m68k: expose system registers to monitors via gdbstub
target/sparc64: expose system registers to monitors via gdbstub
target/riscv: bypass smstateen check in debugger mode
MAINTAINERS: cover riscv GDB XML files
target/riscv: expose register aliases to monitors via gdbstub
monitor/hmp: remove legacy MonitorDef infrastructure
MAINTAINERS | 4 +
configs/targets/i386-bsd-user.mak | 2 +-
configs/targets/i386-linux-user.mak | 2 +-
configs/targets/i386-softmmu.mak | 2 +-
configs/targets/m68k-softmmu.mak | 2 +-
configs/targets/riscv32-linux-user.mak | 2 +-
configs/targets/riscv32-softmmu.mak | 2 +-
configs/targets/riscv64-bsd-user.mak | 2 +-
configs/targets/riscv64-linux-user.mak | 2 +-
configs/targets/riscv64-softmmu.mak | 2 +-
configs/targets/sparc64-softmmu.mak | 2 +-
configs/targets/x86_64-bsd-user.mak | 2 +-
configs/targets/x86_64-linux-user.mak | 2 +-
configs/targets/x86_64-softmmu.mak | 2 +-
docs/about/removed-features.rst | 8 +
gdbstub/gdb-xml/i386-32bit-avx.xml | 20 ++
gdbstub/gdb-xml/i386-32bit-avx512.xml | 31 +++
gdbstub/gdb-xml/i386-32bit-sse.xml | 54 +++++
gdbstub/gdb-xml/i386-32bit.xml | 46 +---
gdbstub/gdb-xml/i386-64bit-avx.xml | 28 +++
gdbstub/gdb-xml/i386-64bit-avx512.xml | 108 +++++++++
gdbstub/gdb-xml/i386-64bit-sse.xml | 62 +++++
gdbstub/gdb-xml/i386-64bit.xml | 50 ----
gdbstub/gdb-xml/i386-system.xml | 53 +++++
gdbstub/gdb-xml/m68k-system.xml | 32 +++
gdbstub/gdb-xml/riscv-32bit-alias.xml | 105 +++++++++
gdbstub/gdb-xml/riscv-32bit-fpu-alias.xml | 40 ++++
gdbstub/gdb-xml/riscv-64bit-alias.xml | 105 +++++++++
gdbstub/gdb-xml/riscv-64bit-fpu-alias.xml | 46 ++++
gdbstub/gdb-xml/sparc64-system.xml | 22 ++
gdbstub/gdbstub.c | 85 +++++--
include/exec/gdbstub.h | 21 ++
include/hw/core/cpu.h | 5 +-
include/hw/core/sysemu-cpu-ops.h | 16 --
include/monitor/hmp.h | 6 -
include/qemu/typedefs.h | 1 -
monitor/hmp.c | 45 +---
target/arm/gdbstub.c | 8 +-
target/arm/gdbstub64.c | 10 +-
target/i386/cpu-dump.c | 5 +-
target/i386/cpu.c | 60 +++--
target/i386/cpu.h | 25 ++
target/i386/gdbstub.c | 373 +++++++++++++++++++++++++++---
target/i386/tcg/fpu_helper.c | 24 +-
target/m68k/cpu.c | 22 --
target/m68k/helper.c | 49 +++-
target/ppc/gdbstub.c | 2 +-
target/riscv/cpu.c | 1 -
target/riscv/gdbstub.c | 57 ++++-
target/riscv/internals.h | 3 -
target/riscv/monitor.c | 140 -----------
target/riscv/tcg/csr.c | 3 +-
target/sparc/cpu.c | 19 --
target/sparc/gdbstub.c | 38 +++
target/xtensa/cpu.c | 2 +-
tests/qtest/test-hmp.c | 1 -
56 files changed, 1383 insertions(+), 478 deletions(-)
---
base-commit: 8967b2fe1b2aaae3c29e207d85fab901d580a2dc
change-id: 20260910-query-reg-80cd59cf4707
Best regards,
--
Marc-André Lureau <marcandre.lureau@redhat.com>