[Lldb-commits] [lldb] 481bb62 - [lldb] Assert immediately prior to calling PopPlan
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 14 08:51:20 PST 2023
Author: David Spickett
Date: 2023-12-14T16:51:12Z
New Revision: 481bb62e50317cf20df9493aad842790162ac3e7
URL: https://github.com/llvm/llvm-project/commit/481bb62e50317cf20df9493aad842790162ac3e7
DIFF: https://github.com/llvm/llvm-project/commit/481bb62e50317cf20df9493aad842790162ac3e7.diff
LOG: [lldb] Assert immediately prior to calling PopPlan
This is part of ongoing attempts to catch the test from
2684281d208612a746b05c891f346bd7b95318d5 failing on Arm and AArch64.
I did get logs for the failure but only on Arm, where the backtrace is
truncated. So, let's do the assert that PopPlan was going to do,
before we call it.
Then I should know exactly which PopPlan is asserting.
Technically I should take a mutex here, but technically I shouldn't
be debugging via buildbot, so I'm going to take the risk temporarily.
Added:
Modified:
lldb/source/Target/Thread.cpp
Removed:
################################################################################
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 6d634f25edf8a4..11aff37ac8c636 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -717,6 +717,16 @@ void Thread::DidResume() {
void Thread::DidStop() { SetState(eStateStopped); }
+#define CHECK_BEFORE_POP_PLAN \
+ { \
+ uint32_t i = 0; \
+ ThreadPlanSP p; \
+ while ((p = GetPlans().GetPlanByIndex(i, false))) \
+ i++; \
+ (void)i;
+assert(i != 1 && "Cannot pop plan when there is only one plan (the base plan)");
+}
+
bool Thread::ShouldStop(Event *event_ptr) {
ThreadPlan *current_plan = GetCurrentPlan();
@@ -831,7 +841,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
do {
if (should_stop)
current_plan->WillStop();
- assert(!current_plan->IsBasePlan() && "Cannot pop base plan!");
+ CHECK_BEFORE_POP_PLAN;
PopPlan();
} while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
// Now, if the responsible plan was not "Okay to discard" then
@@ -884,6 +894,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
// If a Controlling Plan wants to stop, we let it. Otherwise, see if
// the plan's parent wants to stop.
+ CHECK_BEFORE_POP_PLAN;
PopPlan();
if (should_stop && current_plan->IsControllingPlan() &&
!current_plan->OkayToDiscard()) {
@@ -932,6 +943,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
// plan is complete but does not explain the stop (example: step to a
// line with breakpoint), let us move the plan to
// completed_plan_stack anyway
+ CHECK_BEFORE_POP_PLAN;
PopPlan();
} else
DiscardPlan();
More information about the lldb-commits
mailing list