From: Francesco Cagnin <fcag...@quarkslab.com> This patch series aims to add gdbstub support to HVF (the 'QEMU accelerator on macOS that employs Hypervisor.framework') on Apple Silicon hosts.
The proposed implementation, structured like the KVM counterpart, handles single-stepping, software breakpoints, hardware breakpoints and hardware watchpoints. The patch has been most recently tested working on a macOS Ventura 13.4 ARM64 host and a Linux kernel 5.19 guest with the test script 'tests/guest-debug/test-gdbstub.py' (slightly updated to make it work with Linux kernels compiled on macOS, see https://gitlab.com/qemu-project/qemu/-/issues/1489). This version of the patch should fix previously reported issues on multi-cores guests. No other issues are known. The patch has been tested on top of QEMU v8.0.1 dabb418. v5: * Split patch into multiple commits (as per suggestion on v4) * Update `hvf_arm_init_debug()` so it's not called multiple times on SMP guests (as per suggestion on v4) * Fix add `hvf_arch_set_traps()` to enable/disable exiting the guest on all vCPUs * Fix share a single `hvf_sw_breakpoints` across all vCPUs * Fix add missing `QTAILQ_INIT()` for `hvf_sw_breakpoints` Francesco Cagnin (4): arm: move KVM breakpoints helpers hvf: handle access for more registers hvf: add breakpoint handlers hvf: add guest debugging handlers for Apple Silicon hosts accel/hvf/hvf-accel-ops.c | 119 ++++++ accel/hvf/hvf-all.c | 23 ++ include/sysemu/hvf.h | 37 ++ include/sysemu/hvf_int.h | 2 + target/arm/hvf/hvf.c | 750 +++++++++++++++++++++++++++++++++++++- target/arm/hvf_arm.h | 7 + target/arm/hyp_gdbstub.c | 253 +++++++++++++ target/arm/internals.h | 50 +++ target/arm/kvm64.c | 276 -------------- target/arm/meson.build | 3 +- target/i386/hvf/hvf.c | 33 ++ 11 files changed, 1274 insertions(+), 279 deletions(-) create mode 100644 target/arm/hyp_gdbstub.c -- 2.40.1