From: vince <liuwf0302@gmail.com>
To: kvm@vger.kernel.org
Cc: ryan.roberts@arm.com, will@kernel.org,
julien.thierry.kdev@gmail.com, vince <liuwf0302@gmail.com>
Subject: [PATCH v3 0/3] Add GDB remote debug stub for x86 and arm64
Date: Wed, 1 Apr 2026 12:20:31 +0800 [thread overview]
Message-ID: <20260401042034.755639-1-liuwf0302@gmail.com> (raw)
In-Reply-To: <177457996500.86179.14991222733583648054@gmail.com>
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
--
2.34.1
next prev parent reply other threads:[~2026-04-01 4:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 15:41 [PATCH kvmtool 0/2] Add GDB stub and step-debug support for x86 and arm64 vince
2026-03-18 15:41 ` [PATCH 1/2] x86: Add GDB stub and step-debug support vince
2026-03-18 15:41 ` [PATCH 2/2] arm64: " vince
2026-03-25 14:24 ` Ben Horgan
2026-03-27 2:37 ` [PATCH kvmtool " vince
2026-03-25 6:48 ` [PATCH kvmtool 0/2] Add GDB stub and step-debug support for x86 and arm64 vince
2026-03-27 2:48 ` [PATCH v2 " vince
2026-03-27 2:48 ` [PATCH v2 1/2] x86: Add GDB stub and step-debug support vince
2026-03-27 2:48 ` [PATCH v2 2/2] arm64: " vince
2026-04-01 4:20 ` vince [this message]
2026-04-01 4:20 ` [PATCH v3 1/3] x86: " vince
2026-04-01 4:20 ` [PATCH v3 2/3] arm64: " vince
2026-04-01 4:20 ` [PATCH v3 3/3] arm64: Sync guest instruction patches for GDB breakpoints vince
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401042034.755639-1-liuwf0302@gmail.com \
--to=liuwf0302@gmail.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox