From 3ee12ef26ed534af3d0c85f88df7b06db037bfe3 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 30 May 2012 02:19:25 +0000 Subject: 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().) llvm-svn: 157668 --- .../ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp') diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp index ff135806f28..00c90c6eacd 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp @@ -43,13 +43,14 @@ AppleObjCSymbolVendor::FindTypes (const SymbolContext& sc, uint32_t ret = 0; - ModuleList &images = m_process->GetTarget().GetImages(); + ModuleList &target_modules = m_process->GetTarget().GetImages(); + Mutex::Locker modules_locker(target_modules.GetMutex()); - for (size_t image_index = 0, end_index = images.GetSize(); + for (size_t image_index = 0, end_index = target_modules.GetSize(); image_index < end_index; ++image_index) { - Module *image = images.GetModulePointerAtIndex(image_index); + Module *image = target_modules.GetModulePointerAtIndexUnlocked(image_index); if (!image) continue; -- cgit v1.2.3