[Lldb-commits] [PATCH] D71440: Extending step-over range past calls was causing deadlocks, fix that.

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 12 16:13:06 PST 2019

jingham created this revision.
jingham added a reviewer: clayborg.
jingham added a project: LLDB.
Herald added subscribers: lldb-commits, jfb.

This change:


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...

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71440.233702.patch
Type: text/x-patch
Size: 10201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191213/0a64db6a/attachment-0001.bin>

More information about the lldb-commits mailing list