summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-05-30 02:19:25 +0000
committerJim Ingham <jingham@apple.com>2012-05-30 02:19:25 +0000
commit3ee12ef26ed534af3d0c85f88df7b06db037bfe3 (patch)
tree9d46961f3981c27e927926a4ea7d5a2c2b0b6ba7 /lldb/source/Expression
parent13586ab6d8a1c9f373315a70c384f67089c2371e (diff)
downloadbcm5719-llvm-3ee12ef26ed534af3d0c85f88df7b06db037bfe3.tar.gz
bcm5719-llvm-3ee12ef26ed534af3d0c85f88df7b06db037bfe3.zip
We were accessing the ModuleList in the target without locking it for tasks like
setting breakpoints. That's dangerous, since while we are setting a breakpoint, the target might hit the dyld load notification, and start removing modules from the list. This change adds a GetMutex accessor to the ModuleList class, and uses it whenever we are accessing the target's ModuleList (as returned by GetImages().) <rdar://problem/11552372> llvm-svn: 157668
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 4c31c223b89..605747adb56 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -561,13 +561,14 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context,
}
else
{
- ModuleList &images = m_target->GetImages();
+ ModuleList &target_images = m_target->GetImages();
+ Mutex::Locker modules_locker (target_images.GetMutex());
- for (uint32_t i = 0, e = images.GetSize();
+ for (uint32_t i = 0, e = target_images.GetSize();
i != e;
++i)
{
- lldb::ModuleSP image = images.GetModuleAtIndex(i);
+ lldb::ModuleSP image = target_images.GetModuleAtIndexUnlocked(i);
if (!image)
continue;
@@ -1339,14 +1340,16 @@ ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespac
}
else
{
- ModuleList &images = m_target->GetImages();
+ ModuleList &target_images = m_target->GetImages();
+ Mutex::Locker modules_locker(target_images.GetMutex());
+
ClangNamespaceDecl null_namespace_decl;
- for (uint32_t i = 0, e = images.GetSize();
+ for (uint32_t i = 0, e = target_images.GetSize();
i != e;
++i)
{
- lldb::ModuleSP image = images.GetModuleAtIndex(i);
+ lldb::ModuleSP image = target_images.GetModuleAtIndexUnlocked(i);
if (!image)
continue;
OpenPOWER on IntegriCloud