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 macOS Ventura 13.3 hosts and single-core Linux kernel 5.19 guests 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). The patch still has uninvestigated issues with multi-cores guests (see thread https://www.mail-archive.com/qemu-devel@nongnu.org/msg932884.html). v4: * Add license and copyright comment in 'hyp_gdbstub.c' * Fix build on x86 macos * Add architecture specific functions to check guest debug support * Move include to the top of the file in 'hvf.h' * Merge patches 2 and 3 from previous patch series * Re-inject EC_AA64_BKPT into the guest if unhandled * Add comments explaining how debug registers are handled * Minor refactor around debug registers for readability * Other minor changes Francesco Cagnin (2): arm: move KVM breakpoints helpers hvf: implement guest debugging on Apple Silicon hosts accel/hvf/hvf-accel-ops.c | 115 +++++++ accel/hvf/hvf-all.c | 23 ++ include/sysemu/hvf.h | 34 ++ include/sysemu/hvf_int.h | 1 + target/arm/hvf/hvf.c | 709 +++++++++++++++++++++++++++++++++++++- 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 ++ 10 files changed, 1218 insertions(+), 279 deletions(-) create mode 100644 target/arm/hyp_gdbstub.c -- 2.40.0