[Lldb-commits] [lldb] [lldb] Fix crash in BreakpointSite::BumpHitCounts (PR #166876)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 7 10:06:42 PST 2025
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
More information about the lldb-commits
mailing list