Add GDB remote debug stub for x86 and arm64
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 1 replyIn review
- v22 patches 0 repliesSuperseded
- v12 patches 3 repliesSuperseded
Changes in v3 from the cover letter
- x86/gdb.c: Fix all C89 violations (mixed declarations, for-init)
- x86/gdb.c: Add empty kvm_gdb__arch_sync_guest_insn() (x86 coherent)
- gdb.c: Fix wrong PHYS_OFFSET comment (0x40000000 -> 0x80000000)
- gdb.c: Fix C89 violations in arm64_sw_walk_ttbr1()
- gdb.c: Fix gdb_disable_debug() to issue KVM_SET_GUEST_DEBUG(control=0)
- gdb.c: Add 'M' packet payload length validation
- gdb.c: Refactor gdb_write_guest_mem() to pass sync_icache flag
- arm/aarch64/gdb.c: Remove unused macros (BRK0_INSN, ESR_EC_*)
- arm/aarch64/gdb.c: Fix uninitialized pc in kvm_gdb__arch_reinject_sw_bp()
- All files: Replace non-ASCII Unicode characters with ASCII equivalents
- Drop gdb-stub-security-notes.md and gdb-stub-test-spec.md from the series
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | x86: Add GDB stub and step-debug supportMakefile README builtin-run.c +11 more | +3355 | 0 replies | |
| 2/3 | arm64: Add GDB stub and step-debug supportMakefile arm/ include/ | +747 | 0 replies | |
| 3/3 | arm64: Sync guest instruction patches for GDB breakpointsarm/ include/ x86/ | +22 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/3] Add GDB remote debug stub for x86 and arm64
This series adds a GDB Remote Serial Protocol (RSP) stub to kvmtool, enabling source-level debugging of guest kernels via gdb target remote.
Supported features:
- Software breakpoints (INT3 / BRK #0) with guest memory read/write
- Hardware breakpoints via DR7 (x86) / KVM_SET_GUEST_DEBUG (arm64)
- Single-step via RFLAGS.TF (x86) / PSTATE.SS (arm64)
- General-purpose and system register access
- ARM64 virtual-to-physical address translation (TTBR1 page-table walk)
- I-cache coherency after SW breakpoint patching (arm64)
Usage:
lkvm run --gdb 1234 --gdb-wait ...
(gdb) target remote :1234
Changes in v3:
- x86/gdb.c: Fix all C89 violations (mixed declarations, for-init)
- x86/gdb.c: Add empty kvm_gdb__arch_sync_guest_insn() (x86 coherent)
- gdb.c: Fix wrong PHYS_OFFSET comment (0x40000000 -> 0x80000000)
- gdb.c: Fix C89 violations in arm64_sw_walk_ttbr1()
- gdb.c: Fix gdb_disable_debug() to issue KVM_SET_GUEST_DEBUG(control=0)
- gdb.c: Add 'M' packet payload length validation
- gdb.c: Refactor gdb_write_guest_mem() to pass sync_icache flag
- arm/aarch64/gdb.c: Remove unused macros (BRK0_INSN, ESR_EC_*)
- arm/aarch64/gdb.c: Fix uninitialized pc in kvm_gdb__arch_reinject_sw_bp()
- All files: Replace non-ASCII Unicode characters with ASCII equivalents
- Drop gdb-stub-security-notes.md and gdb-stub-test-spec.md from the series
vince (3):
x86: Add GDB stub and step-debug support
arm64: Add GDB stub and step-debug support
arm64: Sync guest instruction patches for GDB breakpoints
Makefile | 13 +- README | 29 + arm/aarch64/gdb.c | 753 +++++++++++ builtin-run.c | 13 +- docs/gdb-stub-architecture.md | 142 ++ gdb.c | 2225 ++++++++++++++++++++++++++++++++ include/kvm/gdb.h | 148 +++ include/kvm/kvm-config.h | 2 + kvm-cpu.c | 9 +- term.c | 18 +- tests/Makefile | 4 + tests/boot/Makefile | 10 +- tests/gdb/Makefile | 8 + tests/gdb/test-x86-gdb-stub.py | 178 +++ x86/gdb.c | 582 +++++++++ 15 files changed, 4122 insertions(+), 12 deletions(-) create mode 100644 arm/aarch64/gdb.c create mode 100644 docs/gdb-stub-architecture.md create mode 100644 gdb.c create mode 100644 include/kvm/gdb.h create mode 100644 tests/gdb/Makefile create mode 100644 tests/gdb/test-x86-gdb-stub.py create mode 100644 x86/gdb.c
Signature · 1 line
2.34.1