[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts
From: |
Mads Ynddal |
Subject: |
Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts |
Date: |
Mon, 7 Nov 2022 13:38:35 +0100 |
> On 4 Nov 2022, at 19.41, francesco.cagnin@gmail.com wrote:
>
> From: Francesco Cagnin <fcagnin@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 <fcagnin@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?
- [PATCH 0/3] Add gdbstub support to HVF, francesco . cagnin, 2022/11/04
- [PATCH 3/3] hvf: handle writes of MDSCR_EL1 and DBG*_EL1, francesco . cagnin, 2022/11/04
- [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, francesco . cagnin, 2022/11/04
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts,
Mads Ynddal <=
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Mads Ynddal, 2022/11/07
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Francesco Cagnin, 2022/11/08
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Mads Ynddal, 2022/11/08
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Mads Ynddal, 2022/11/09
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Peter Maydell, 2022/11/09
- Re: [PATCH 2/3] hvf: implement guest debugging on Apple Silicon hosts, Francesco Cagnin, 2022/11/09