summaryrefslogtreecommitdiffstats
path: root/lldb/source/Breakpoint
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/Breakpoint
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/Breakpoint')
-rw-r--r--lldb/source/Breakpoint/Breakpoint.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index 5d0cbd47e20..789118b3a40 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -317,6 +317,7 @@ Breakpoint::ClearAllBreakpointSites ()
void
Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_locations)
{
+ Mutex::Locker modules_mutex(module_list.GetMutex());
if (load)
{
// The logic for handling new modules is:
@@ -332,11 +333,11 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca
// resolving breakpoints will add new locations potentially.
const size_t num_locs = m_locations.GetSize();
-
- for (size_t i = 0; i < module_list.GetSize(); i++)
+ size_t num_modules = module_list.GetSize();
+ for (size_t i = 0; i < num_modules; i++)
{
bool seen = false;
- ModuleSP module_sp (module_list.GetModuleAtIndex (i));
+ ModuleSP module_sp (module_list.GetModuleAtIndexUnlocked (i));
if (!m_filter_sp->ModulePasses (module_sp))
continue;
@@ -403,10 +404,11 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca
shared_from_this());
else
removed_locations_event = NULL;
-
- for (size_t i = 0; i < module_list.GetSize(); i++)
+
+ size_t num_modules = module_list.GetSize();
+ for (size_t i = 0; i < num_modules; i++)
{
- ModuleSP module_sp (module_list.GetModuleAtIndex (i));
+ ModuleSP module_sp (module_list.GetModuleAtIndexUnlocked (i));
if (m_filter_sp->ModulePasses (module_sp))
{
size_t loc_idx = 0;
OpenPOWER on IntegriCloud