[Lldb-commits] [lldb] [lldb] Fix crash in BreakpointSite::BumpHitCounts (PR #166876)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 10:10:53 PST 2025


https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/166876

>From 38d0bd20d4b3d7b5fb7c053684a533b15510897f Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Thu, 6 Nov 2025 16:07:30 -0800
Subject: [PATCH] [lldb] Fix crash in BreakpointSite::BumpHitCounts

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.

rdar://163760832
---
 lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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



More information about the lldb-commits mailing list