summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
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/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
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/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp')
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index c8e9cec70c5..c42f469fea6 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1057,12 +1057,14 @@ DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
// to an equivalent version. We don't want it to stay in the target's module list or it will confuse
// us, so unload it here.
Target &target = m_process->GetTarget();
- ModuleList &modules = target.GetImages();
+ ModuleList &target_modules = target.GetImages();
ModuleList not_loaded_modules;
- size_t num_modules = modules.GetSize();
+ Mutex::Locker modules_locker(target_modules.GetMutex());
+
+ size_t num_modules = target_modules.GetSize();
for (size_t i = 0; i < num_modules; i++)
{
- ModuleSP module_sp = modules.GetModuleAtIndex(i);
+ ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked (i);
if (!module_sp->IsLoadedInTarget (&target))
{
if (log)
OpenPOWER on IntegriCloud