Skip to content

Commit d14d521

Browse files
committed
[lldb][test] Add extra logging for module cache test
And remove the workaround I was trying, as this logging may prove what the actual issue is. Which I think is that the thread plan map in Process is cleared before the threads are destroyed. So Thread::ShouldStop could be getting the current plan, then the plan map is cleared, then Thread::ShouldStop is deciding based on that plan to pop a plan from the now empty stack.
1 parent 3ae5a9b commit d14d521

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

lldb/source/Target/Thread.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,18 @@ bool Thread::ShouldStop(Event *event_ptr) {
883883
// If a Controlling Plan wants to stop, we let it. Otherwise, see if
884884
// the plan's parent wants to stop.
885885

886+
// Temporary logging to figure out a crash on Arm/AArch64 Linux.
887+
{
888+
LLDB_LOGF(log, "^^^^^^^^ Thread::ShouldStop plan stack before "
889+
"PopPlan ^^^^^^^^");
890+
StreamString s;
891+
s.IndentMore();
892+
GetProcess()->DumpThreadPlansForTID(
893+
s, GetID(), eDescriptionLevelVerbose, true /* internal */,
894+
false /* condense_trivial */, true /* skip_unreported */);
895+
LLDB_LOG(log, s.GetData());
896+
}
897+
886898
PopPlan();
887899
if (should_stop && current_plan->IsControllingPlan() &&
888900
!current_plan->OkayToDiscard()) {

lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def copy_to_main(self, src, dst):
3434
# The rerun tests indicate rerunning on Windows doesn't really work, so
3535
# this one won't either.
3636
@skipIfWindows
37+
# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
38+
# we only have the base plan remaining. Skip it until we can figure out
39+
# the bug this is exposing.
40+
@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
3741
def test_OneTargetOneDebugger(self):
3842
self.do_test(True, True)
3943

@@ -50,6 +54,11 @@ def test_OneTargetTwoDebuggers(self):
5054
self.do_test(True, False)
5155

5256
def do_test(self, one_target, one_debugger):
57+
# Here to debug flakiness on Arm, remove later!
58+
log_cmd_result = lldb.SBCommandReturnObject()
59+
interp = self.dbg.GetCommandInterpreter()
60+
interp.HandleCommand("log enable lldb step", log_cmd_result)
61+
5362
# Make sure that if we have one target, and we run, then
5463
# change the binary and rerun, the binary (and any .o files
5564
# if using dwarf in .o file debugging) get removed from the
@@ -100,13 +109,6 @@ def do_test(self, one_target, one_debugger):
100109
self.old_debugger = self.dbg
101110
self.dbg = new_debugger
102111
def cleanupDebugger(self):
103-
# On Arm and AArch64 Linux, it is suspected that destroying
104-
# the debugger first causes lldb to try to pop from an empty
105-
# thread plan stack. Try to prove this by killing the process
106-
# first.
107-
for i in range(self.dbg.GetNumTargets()):
108-
self.dbg.GetTargetAtIndex(i).GetProcess().Kill()
109-
110112
lldb.SBDebugger.Destroy(self.dbg)
111113
self.dbg = self.old_debugger
112114
self.old_debugger = None

0 commit comments

Comments
 (0)