[compiler-rt] 22602c4 - [NFC][hwasan] Extract announce_by_id (#66682)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 19:32:20 PDT 2023


Author: Vitaly Buka
Date: 2023-09-19T19:29:33-07:00
New Revision: 22602c48d1e0974764daa2c5558452e963b801f2

URL: https://github.com/llvm/llvm-project/commit/22602c48d1e0974764daa2c5558452e963b801f2
DIFF: https://github.com/llvm/llvm-project/commit/22602c48d1e0974764daa2c5558452e963b801f2.diff

LOG: [NFC][hwasan] Extract announce_by_id (#66682)

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 0edfa7a53b369bf..c7683698a76de07 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -586,6 +586,13 @@ void BaseReport::PrintAddressDescription() const {
         untagged_addr - heap.begin, d.Default());
   }
 
+  auto announce_by_id = [](u32 thread_id) {
+    hwasanThreadList().VisitAllLiveThreads([&](Thread *t) {
+      if (thread_id == t->unique_id())
+        t->Announce();
+    });
+  };
+
   // Check stack first. If the address is on the stack of a live thread, we
   // know it cannot be a heap / global overflow.
   for (uptr i = 0; i < stack_allocations_count; ++i) {
@@ -598,11 +605,7 @@ void BaseReport::PrintAddressDescription() const {
     Printf("Address %p is located in stack of thread T%zd\n", untagged_addr,
            allocations.thread_id());
     Printf("%s", d.Default());
-    hwasanThreadList().VisitAllLiveThreads([&](Thread *t) {
-      if (allocations.thread_id() == t->unique_id())
-        t->Announce();
-    });
-
+    announce_by_id(allocations.thread_id());
     PrintStackAllocations(allocations.get(), ptr_tag, untagged_addr);
     num_descriptions_printed++;
   }


        


More information about the llvm-commits mailing list