llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Fix crash in `BreakpointSite::BumpHitCounts` due to missing synchronization. 
When bumping the hit count, we were correctly acquiring the constituents mutex, 
but didn't protect the breakpoint location collection. This PR fixes the issue 
by making the iterator returned by the collection a `LockingAdaptedIterable`. 

rdar://163760832

---
Full diff: https://github.com/llvm/llvm-project/pull/166876.diff


1 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h (+3-2) 


``````````diff
diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
index 124cb55eaf723..372bd0c51fe20 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
@@ -179,10 +179,11 @@ class BreakpointLocationCollection {
       m_preserved_bps;
 
 public:
-  typedef llvm::iterator_range<collection::const_iterator>
+  typedef LockingAdaptedIterable<std::mutex, collection>
       BreakpointLocationCollectionIterable;
   BreakpointLocationCollectionIterable BreakpointLocations() {
-    return BreakpointLocationCollectionIterable(m_break_loc_collection);
+    return BreakpointLocationCollectionIterable(m_break_loc_collection,
+                                                m_collection_mutex);
   }
 };
 } // namespace lldb_private

``````````

</details>


https://github.com/llvm/llvm-project/pull/166876
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to