Message ID | 55E7493A.7030704@gmail.com |
---|---|
State | New |
Headers | show |
On 2 September 2015 at 20:08, Sergey Fedorov <serge.fdrv@gmail.com> wrote: > With the following patch the test is okay, but I am not sure that this > is a clean solution. Anyway, we can't do such a simple hack for > breakpoints. Seems that this is a systematic problem which can affect > all architectures. I think it won't affect architectures that don't set BP_STOP_BEFORE_ACCESS, because for those we will execute the load before trying to see if there is a watchpoint to take, and if there's no CPU watchpoint we'll be able to continue normally. So ARM, LM32, S390x and Xtensa might be affected. And of course any architecture which only sets up wps/bps which will definitely be hit architecturally when QEMU thinks they've been hit will be fine. Maybe rather than trying to be clever with the existing wp APIs we should have support for targets to register "did this really hit?" callbacks that get called before the core code tries to really generate the exception. I don't think I can really look in detail at this problem til next week at the earliest, though. thanks -- PMM
On 02.09.2015 22:45, Peter Maydell wrote: > Maybe rather than trying to be clever with the existing wp APIs > we should have support for targets to register "did this really hit?" > callbacks that get called before the core code tries to really > generate the exception. Thank you, Peter, for the sensible suggestion. I'm going to stick to this approach. As of breakpoints, it seems to be enough to use a helper for that purpose. > I don't think I can really look in detail at this problem til next > week at the earliest, though. I hope I will prepare and send relevant patches by that time :) Best, Sergey
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index 66edbe9..013ac7e 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -878,11 +878,12 @@ void arm_debug_excp_handler(CPUState *cs) if (wp_hit) { if (wp_hit->flags & BP_CPU) { - cs->watchpoint_hit = NULL; if (check_watchpoints(cpu)) { bool wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0; bool same_el = arm_debug_target_el(env) == arm_current_el(env); + cs->watchpoint_hit = NULL; + if (extended_addresses_enabled(env)) { env->exception.fsr = (1 << 9) | 0x22;