virtual bool ShouldStop(Event *event_ptr) = 0;
+ /// Returns whether this thread plan overrides the `ShouldStop` of
+ /// subsequently processed plans.
+ ///
+ /// When processing the thread plan stack, this function gives plans the
+ /// ability to continue - even when subsequent plans return true 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".
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,
}
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()) {
if (should_stop)
current_plan->WillStop();
- // If a Master Plan wants to stop, and wants to stick on the stack,
- // we let it. Otherwise, see if the plan's parent wants to stop.
+ 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.
+ PopPlan();
if (should_stop && current_plan->IsMasterPlan() &&
!current_plan->OkayToDiscard()) {
- PopPlan();
break;
- } else {
- PopPlan();
+ }
- current_plan = GetCurrentPlan();
- if (current_plan == nullptr) {
- break;
- }
+ current_plan = GetCurrentPlan();
+ if (current_plan == nullptr) {
+ break;
}
} else {
break;
}
}
- if (over_ride_stop)
+ if (override_stop)
should_stop = false;
}