This change:
https://reviews.llvm.org/D58678
made lldb extend it's "next branch breakpoint" over IsCall instructions as a way to speed up stepping. However, the change wasn't quite complete. When lldb runs to the "next branch breakpoint" it always stops other threads when doing so. That is because as much as possible we want users to be able to focus on the thread they are debugging, and not have events from other threads disrupt their attention.
It was safe to do this for code in a function because, except in very odd circumstances, the actions that might deadlock are always function calls.
Before this change we would run to the call, step into a function, then step out. And we always run all threads when we step out of a function call.
With the change, we were extending the range past the call, but treating it as "code in the function", which it no longer was. That would mean we were running arbitrary code with only on thread running, and that causes deadlocks in the target, and then the "step-over" would never complete.
This patch adds a parameter to GetIndexOfNextBranchInstruction telling whether we did extend past a call or not. Then in ThreadPlanStepOverRange, we check this parameter and run one thread or all threads depending on whether we extended past a call.
I also added a test case for this behavior. It is a little unfortunate that the failure of the test will really be a timeout since if we do it wrong the step-over doesn't return. But I can't think of a better way of doing it. I don't want to add a watchdog timer because then I'd get spurious failures on slow machines or fight against the overall timeouts...