[scudo] Improve Secondary Cache Dump
authorfernandosalas <fernandosalas@google.com>
Fri, 30 Jun 2023 20:55:40 +0000 (20:55 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Fri, 30 Jun 2023 20:55:41 +0000 (20:55 +0000)
Exclude cached blocks with invalid start address. Mainly concerned with
cached blocks that are still available/unused.

Reviewed By: Chia-hungDuan, cferris

Differential Revision: https://reviews.llvm.org/D154148

compiler-rt/lib/scudo/standalone/secondary.h

index 5217b71..105b154 100644 (file)
@@ -143,9 +143,11 @@ public:
                 EntriesCount, atomic_load_relaxed(&MaxEntriesCount),
                 atomic_load_relaxed(&MaxEntrySize));
     for (CachedBlock Entry : Entries) {
+      if (!Entry.CommitBase)
+        continue;
       Str->append("StartBlockAddress: 0x%zx, EndBlockAddress: 0x%zx, "
                   "BlockSize: %zu\n",
-                  Entry.CommitBase, (Entry.CommitBase + Entry.CommitSize),
+                  Entry.CommitBase, Entry.CommitBase + Entry.CommitSize,
                   Entry.CommitSize);
     }
   }