Skip to content

monitor/hmp: replace MonitorDef with GDB registers

Marc-André Lureau qemu-arm qemu-devel qemu-riscv 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20260910-query-reg-80cd59cf4707

Versions newest first

  1. v3 Latest18 patches 13 repliesIn review
  2. v210 patches 5 repliesSuperseded
  3. v110 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- 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/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18hmp: don't crash on invalid registermonitor/hmp.c+1 -10 replies
2/18gdbstub: fix next register base after register gapsgdbstub/gdbstub.c include/hw/core/cpu.h target/arm/gdbstub.c +4 more+28 -210 replies
3/18gdbstub: set feature->base_reg for dynamic featuresgdbstub/gdbstub.c+1 -00 replies
4/18gdbstub: add gdb_register_internal_coprocessor()gdbstub/gdbstub.c include/exec/gdbstub.h+84 -81 reply
5/18MAINTAINERS: cover x86 GDB XML filesMAINTAINERS+1 -01 reply
6/18target/i386: expose segment limits register to monitors via gdbstubconfigs/targets/i386-softmmu.mak configs/targets/x86_64-softmmu.mak gdbstub/gdb-xml/i386-system.xml +2 more+41 -110 replies
7/18target/i386: fix FPU tag word in GDB register readtarget/i386/cpu.c target/i386/cpu.h target/i386/gdbstub.c +1 more+40 -230 replies
8/18target/i386: split SSE registers into separate GDB featureconfigs/targets/i386-bsd-user.mak configs/targets/i386-linux-user.mak configs/targets/i386-softmmu.mak +8 more+172 -1280 replies
9/18target/i386: expose system registers to monitors via gdbstubgdbstub/gdb-xml/i386-system.xml target/i386/cpu-dump.c target/i386/cpu.h +1 more+181 -130 replies
10/18target/i386: expose AVX/AVX-512 registers to GDBconfigs/targets/i386-bsd-user.mak configs/targets/i386-linux-user.mak configs/targets/i386-softmmu.mak +8 more+346 -70 replies
11/18target/i386: drop HMP $pcdocs/about/removed-features.rst target/i386/cpu.c tests/qtest/test-hmp.c+8 -243 replies
12/18MAINTAINERS: cover m68k GDB XML filesMAINTAINERS+2 -01 reply
13/18target/m68k: expose system registers to monitors via gdbstubconfigs/targets/m68k-softmmu.mak gdbstub/gdb-xml/m68k-system.xml target/m68k/cpu.c +1 more+81 -241 reply
14/18target/sparc64: expose system registers to monitors via gdbstubconfigs/targets/sparc64-softmmu.mak gdbstub/gdb-xml/sparc64-system.xml target/sparc/cpu.c +1 more+61 -200 replies
15/18target/riscv: bypass smstateen check in debugger modetarget/riscv/tcg/csr.c+2 -10 replies
16/18MAINTAINERS: cover riscv GDB XML filesMAINTAINERS+1 -01 reply
17/18target/riscv: expose register aliases to monitors via gdbstubconfigs/targets/riscv32-linux-user.mak configs/targets/riscv32-softmmu.mak configs/targets/riscv64-bsd-user.mak +10 more+349 -1491 reply
18/18monitor/hmp: remove legacy MonitorDef infrastructureinclude/hw/core/sysemu-cpu-ops.h include/monitor/hmp.h include/qemu/typedefs.h +1 more+1 -651 reply

Reviews trailers per patch

10 of 18 patches have a Reviewed-by or Acked-by.

PatchAlex BennéePhilippe Mathieu-DaudéDaniel Henrique BarbozaChao LiuPierrick Bouvier
1/18R-b
2/18A-b
3/18R-b
4/18R-b
5/18R-b
6/18
7/18
8/18
9/18
10/18
11/18
12/18R-b
13/18
14/18
15/18R-b R-b
16/18R-b
17/18R-b
18/18R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/18] monitor/hmp: replace MonitorDef with GDB registers

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")

---
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/[email protected]

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/[email protected]

---
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,

Signature · 1 line
Marc-André Lureau <[email protected]>