On some architectures - e.g. aarch64 - the watchpoint exception is raised before the instruction that would have triggered it gets run. We want to report old/new values, however, so we need to have executed the instruction before reporting the stop. That means before reporting the stop, we need to do one stepi on the thread that got the watchpoint exception.
The original version of this code implemented this incorrectly. It did the step over synchronously in the StopInfoWatchpoint::ShouldStopSynchronous. You should NEVER run the target in ShouldStopSynchronous. If you do that, then any other threads that had interesting pending stop info actions won't be able to perform their action because the target will have moved on and invalidated their StopInfo's.
You should always do this kind of thing by pushing the action you want to perform onto the ThreadPlanStack for the thread in question. That way all the threads get to register what they need to do, and then the ThreadList runner can arbitrate among them and do the right thing. For instance, in the case of stepping over watchpoints, each thread stopped on the watchpoint pushes a "step instruction" thread plan that re-instates the original watchpoint StopInfo when complete. If there is more than one thread in this state, lldb notices each of them has a "stop others" plan, and one by one lets each thread step over the watchpoint. When all this work is done, we report all the threads stopped at their watchpoints.
I also fixed a bug in the same code I noticed while reworking this. We were not decrementing the HitCount for the watchpoint if the condition fails. We consider a failed condition to mean "the stop point wasn't hit". It's weird to see a hit count of 5 when the target only told you about one stop... But that wasn't being enforced in the StopInfoWatchpoint::PerformAction.
There was a test that was expecting the now-incorrect value of the hit count in this case, so I fixed that, and also all the tests that were failing because of concurrent access were turned on again and run successfully for me.
There's a bit of funniness for MIPS in the watchpoint support. I am pretty sure I got that right, but I don't have anything MIPS to test that on. The same concurrent watchpoint tests that were marked failing for arm64 Darwin are also marked failed for MIPS, but I am not sure if that's for the same reason. Anyway, if someone has access to a MIPS system, it would be good to try this out and see if it works there as well.
Blank line after this.