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:
- find the plan that explains the stop
- if it's not a master plan, continue processing previous (aka parent) plans
- first, call ShouldAutoContinue on the immediate parent of the explaining plan
- 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 to also call ShouldAutoContinue, giving each plan the opportunity
to override ShouldStop of previous plans.
Why? This allows a plan to do the following:
- mark itself done and be popped off the stack
- allow parent plans to finish up, to also be popped off the stack
- 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.
Happy to iterate on this. I wanted to take the opportunity to explain this, since by name it may seem unclear how exactly it relates to ShouldStop.