[lldb-dev] Continuing from a breakpoint with multiple threads

Jim Ingham jingham at apple.com
Fri May 29 16:50:53 PDT 2015


When stepping over a breakpoint, the ThreadPlanStepOverBreakpoint gets pushed, handles the single instruction step - during which it does suspend the other threads - then it gets popped.  When you next resume, whatever plan was handling the stepping before the breakpoint was hit will resume with whatever policy for running other threads it was using.

So it's up to the plan that was on the stack before the "StepOverBreakpoint" was pushed to decide this.  Most of the more complex plans (like step-over/step-into) try to keep the other threads from running if possible (unless the user instructed otherwise) but they also will let all the threads run if there's something going on that might deadlock.  For instance, if you are doing "next" and we step through straight-line instructions in a function, we will only run the one thread you are stepping in (by default, you can control this with options to the "thread step-over" command.   But if we step into a function, we set a breakpoint on the return address and then run with all threads resumed because stepping out of a function could run arbitrary code.

Anyway, was this a theoretical question, or do you have some instance where you are actually seeing a deadlock?

Jim


> On May 29, 2015, at 1:59 PM, Adrian McCarthy <amccarth at google.com> wrote:
> 
> [I'm trying to make TestBreakAfterJoin work on Windows.]
> 
> I'm unclear how continuing from a breakpoint in a multi-threaded inferior is supposed to work.
> 
> A breakpoint is set, and the inferior runs until one of its threads hits the breakpoint.  The user then selects continue.
> 
> The thread that had hit the breakpoint has a thread plan type of ThreadPlanStepOverBreakpoint, which causes all of the other threads to be set to state eStateSuspended.  The thread that had hit the breakpoint then steps beyond the breakpoint, and the breakpoint is restored.  The thread is then resumed again.
> 
> But the other threads are all still suspended, causing the inferior to deadlock.
> 
> The question is:  Where should the other threads have their resume states set back to a running state?
> 
> Adrian
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list