[Lldb-commits] [lldb] New ThreadPlanSingleThreadTimeout to resolve potential deadlock in single thread stepping (PR #90930)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 12:54:52 PDT 2024


jeffreytan81 wrote:

@jimingham, thanks for the comment.

When I try to add a new testcase for stepping over a function with a user set breakpoint, there is a bug found -- the user set breakpoint did not stop with `ThreadPlanSingleThreadTimeout` present (which is `c` case in your RFC comment)

I did some investigation, when we issue normal step-over, the all thread plans in the stack return false for `PlanExplainsStop`, so base thread plan got a chance to check thread's stop info and stop the execution. 

However, while doing single thread stepping, `ThreadPlanSingleThreadTimeout` as leaf plan always return true for `PlanExplainsStop`, causing the logic to use the second while loop in `Thread::ShouldStop()`, eventually, `ThreadPlanStepOut::MischiefManaged()` returns false causing the loop to terminate early without giving base thread plan to decide should stop or not:
https://github.com/llvm/llvm-project/blob/393eff4e02e7ab3d234d246a8d6912c8e745e6f9/lldb/source/Target/Thread.cpp#L905-L907

So overall the `Thread::ShouldStop()` returns false and ignores the hit inner breakpoint during stepping. Any suggestion how to fix this? 



https://github.com/llvm/llvm-project/pull/90930


More information about the lldb-commits mailing list