Lock the owners mutex in the BreakpointSite before updating the hit
authorJim Ingham <jingham@apple.com>
Wed, 29 Jul 2015 00:40:36 +0000 (00:40 +0000)
committerJim Ingham <jingham@apple.com>
Wed, 29 Jul 2015 00:40:36 +0000 (00:40 +0000)
counts.  If you delete a breakpoint belonging to a site just as you are
processing a hit on that site, you could cause the BreakpointSite loop to
access a now deleted location.

<rdar://problem/19310323>

llvm-svn: 243507

lldb/source/Breakpoint/BreakpointSite.cpp

index e9ce812..95b67b0 100644 (file)
@@ -205,6 +205,7 @@ BreakpointSite::ValidForThisThread (Thread *thread)
 void
 BreakpointSite::BumpHitCounts()
 {
+    Mutex::Locker locker(m_owners_mutex);
     for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
     {
         loc_sp->BumpHitCount();