We no longer need to search for a matched breakpoint, test for BP_CPU, or clear watchpoint_hit.
Signed-off-by: Richard Henderson <[email protected]> --- target/arm/tcg/debug.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index fe8513a5de..d705f7aef2 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -422,42 +422,27 @@ void arm_debug_excp_handler(CPUState *cs, CPUBreakpoint *hit) */ ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; - CPUBreakpoint *wp_hit = cs->watchpoint_hit; + uint32_t excp, syndrome; - if (wp_hit) { - if (wp_hit->flags & BP_CPU) { - bool wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0; + if (hit->flags & BP_MEM_ACCESS) { + bool wnr = hit->flags & BP_WATCHPOINT_HIT_WRITE; + syndrome = syn_watchpoint(0, 0, wnr); + excp = EXCP_DATA_ABORT; - cs->watchpoint_hit = NULL; - - env->exception.fsr = arm_debug_exception_fsr(env); - env->exception.vaddress = wp_hit->hitaddr; - raise_exception_debug(env, EXCP_DATA_ABORT, - syn_watchpoint(0, 0, wnr)); - } + env->exception.vaddress = hit->hitaddr; } else { - uint64_t pc = is_a64(env) ? env->pc : env->regs[15]; + syndrome = syn_breakpoint(0); + excp = EXCP_PREFETCH_ABORT; - /* - * (1) GDB breakpoints should be handled first. - * (2) Do not raise a CPU exception if no CPU breakpoint has fired, - * since singlestep is also done by generating a debug internal - * exception. - */ - if (cpu_breakpoint_test(cs, pc, BP_GDB) - || !cpu_breakpoint_test(cs, pc, BP_CPU)) { - return; - } - - env->exception.fsr = arm_debug_exception_fsr(env); /* * FAR is UNKNOWN: clear vaddress to avoid potentially exposing * values to the guest that it shouldn't be able to see at its * exception/security level. */ env->exception.vaddress = 0; - raise_exception_debug(env, EXCP_PREFETCH_ABORT, syn_breakpoint(0)); } + env->exception.fsr = arm_debug_exception_fsr(env); + raise_exception_debug(env, excp, syndrome); } /* -- 2.43.0
