<rdar://problem/11202426>
Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@154339 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index b61acd7..4c62ffb 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -143,7 +143,12 @@
void
SBDebugger::MemoryPressureDetected ()
{
- ModuleList::RemoveOrphanSharedModules();
+ // Since this function can be call asynchronously, we allow it to be
+ // non-mandatory. We have seen deadlocks with this function when called
+ // so we need to safeguard against this until we can determine what is
+ // causing the deadlocks.
+ const bool mandatory = false;
+ ModuleList::RemoveOrphanSharedModules(mandatory);
}
SBDebugger::SBDebugger () :
@@ -648,7 +653,8 @@
result = m_opaque_sp->GetTargetList().DeleteTarget (target_sp);
target_sp->Destroy();
target.Clear();
- ModuleList::RemoveOrphanSharedModules();
+ const bool mandatory = true;
+ ModuleList::RemoveOrphanSharedModules(mandatory);
}
}