diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -351,6 +351,12 @@ virtual bool ShouldStop(Event *event_ptr) = 0; + /// Returns whether this thread plan overrides the `ShouldStop` of previous + /// plans. + /// + /// When processing the thread plan stack, this function gives plans the + /// ability to continue - even when previous plans subsequently return false + /// from `ShouldStop`. \see Thread::ShouldStop virtual bool ShouldAutoContinue(Event *event_ptr) { return false; } // Whether a "stop class" event should be reported to the "outside world". diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -829,6 +829,8 @@ ThreadPlan *plan_ptr = current_plan; while ((plan_ptr = GetPreviousPlan(plan_ptr)) != nullptr) { if (plan_ptr->PlanExplainsStop(event_ptr)) { + LLDB_LOGF(log, "Plan %s explains stop.", plan_ptr->GetName()); + should_stop = plan_ptr->ShouldStop(event_ptr); // plan_ptr explains the stop, next check whether plan_ptr is done, @@ -858,10 +860,7 @@ } if (!done_processing_current_plan) { - bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr); - - LLDB_LOGF(log, "Plan %s explains stop, auto-continue %i.", - current_plan->GetName(), over_ride_stop); + bool override_stop = false; // We're starting from the base plan, so just let it decide; if (current_plan->IsBasePlan()) { @@ -882,19 +881,24 @@ if (should_stop) current_plan->WillStop(); + PopPlan(); + + if (current_plan->ShouldAutoContinue(event_ptr)) { + override_stop = true; + LLDB_LOGF(log, "Plan %s auto-continue: true.", + current_plan->GetName()); + } + // If a Master Plan wants to stop, we let it. Otherwise, see if the // plan's parent wants to stop. if (should_stop && current_plan->IsMasterPlan()) { - PopPlan(); break; - } else { - PopPlan(); + } - current_plan = GetCurrentPlan(); - if (current_plan == nullptr) { - break; - } + current_plan = GetCurrentPlan(); + if (current_plan == nullptr) { + break; } } else { break; @@ -902,7 +906,7 @@ } } - if (over_ride_stop) + if (override_stop) should_stop = false; }