> On 4 Nov 2022, at 19.41, francesco.cag...@gmail.com wrote: > > From: Francesco Cagnin <fcag...@quarkslab.com> > > Support is added for single-stepping, software breakpoints, hardware > breakpoints and watchpoints. The code has been structured like the KVM > counterpart (and many parts are basically identical). > > Guests can be debugged through the gdbstub. > > Signed-off-by: Francesco Cagnin <fcag...@quarkslab.com> > --- > accel/hvf/hvf-accel-ops.c | 124 ++++++++++++++++++++++++ > accel/hvf/hvf-all.c | 24 +++++ > cpu.c | 3 + > include/sysemu/hvf.h | 29 ++++++ > include/sysemu/hvf_int.h | 1 + > target/arm/hvf/hvf.c | 194 +++++++++++++++++++++++++++++++++++++- > 6 files changed, 374 insertions(+), 1 deletion(-)
I've been working on the exact same features just last week, and had it working just hours before you posted, but you beat me to it. I can see we have solved it almost exactly the same way, so I won't post my patchset. I can see you are missing support for SSTEP_NOIRQ. I've handled it like this: diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 5ff5778d55..8b96d2f320 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -343,7 +343,7 @@ static int hvf_accel_init(MachineState *ms) static int hvf_gdbstub_sstep_flags(void) { - return SSTEP_ENABLE; + return SSTEP_ENABLE | SSTEP_NOIRQ; } static void hvf_accel_class_init(ObjectClass *oc, void *data) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index dbc3605f6d..964a4ecf8a 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1331,7 +1331,7 @@ int hvf_vcpu_exec(CPUState *cpu) hv_return_t r; bool advance_pc = false; - if (hvf_inject_interrupts(cpu)) { + if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && hvf_inject_interrupts(cpu)) { return EXCP_INTERRUPT; } You'll have to suppress the interrupts while you're single-stepping the code. Otherwise, you'll only be stepping a few times, and suddenly get taken to the interrupt-handler. What issues do you have with multi-core systems?