[Lldb-commits] [lldb] [lldb] Fix stale L1 memory cache read after memory write (PR #208347)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 28 02:01:47 PDT 2026


================
@@ -57,18 +86,19 @@ void MemoryCache::Flush(addr_t addr, size_t size) {
 
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
-  // Erase any blocks from the L1 cache that intersect with the flush range
+  // Erase any blocks from the L1 cache that intersect with the flush range. A
+  // chunk that intersects cannot start earlier than this, so scan a bounded
+  // window rather than the whole cache.
   if (!m_L1_cache.empty()) {
     AddrRange flush_range(addr, size);
-    BlockMap::iterator pos = m_L1_cache.upper_bound(addr);
-    if (pos != m_L1_cache.begin()) {
-      --pos;
-    }
-    while (pos != m_L1_cache.end()) {
+    addr_t lowest_possible_start = GetLowestPossibleChunkStart(addr);
----------------
felipepiovezan wrote:

Ah, it's this.
I think the comment is slightly out of place, but IMO we can remove it: the name of this variable is already saying exactly what happens

https://github.com/llvm/llvm-project/pull/208347


More information about the lldb-commits mailing list