[all-commits] [llvm/llvm-project] b0186c: [lldb] Refine ThreadPlan::ShouldAutoContinue

Dave Lee via All-commits all-commits at lists.llvm.org
Sat Feb 20 17:25:56 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0186c25c62e79869d37b81ad819c67a3e97b0cd
      https://github.com/llvm/llvm-project/commit/b0186c25c62e79869d37b81ad819c67a3e97b0cd
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M lldb/include/lldb/Target/ThreadPlan.h
    M lldb/source/Target/Thread.cpp

  Log Message:
  -----------
  [lldb] Refine ThreadPlan::ShouldAutoContinue

Adjust `ShouldAutoContinue` to be available to any thread plan previous to the plan that
explains a stop, not limited to the parent to the plan that explains the stop.

Before this change, `Thread::ShouldStop` did the following:

1. find the plan that explains the stop
2. if it's not a master plan, continue processing previous (aka parent) plans
3. first, call `ShouldAutoContinue` on the immediate parent of the explaining plan
4. then loop over previous plans, calling `ShouldStop` and `MischiefManaged`

Of note, the iteration in step 4 does not call `ShouldAutoContinue`, so again only the
plan just prior to the explaining plan is given the opportunity to override whether to
continue or stop.

This commit changes the loop call `ShouldAutoContinue`, giving each plan the opportunity
to override `ShouldStop` of previous plans.

Why? This allows a plan to do the following:

1. mark itself done and be popped off the stack
2. allow parent plans to finish their work, and to also be popped off the stack
3. and finally, have the thread continue, not stop

This is useful for stepping into async functions. A plan will would step far enough
enough to set a breakpoint on the async target, and then use `ShouldAutoContinue` to
unwind the necessary stepping, and then have the calling thread continue.

Differential Revision: https://reviews.llvm.org/D97076




More information about the All-commits mailing list