Skip to content

Commit 22602c4

Browse files
committed
[NFC][hwasan] Extract announce_by_id (#66682)
1 parent 5670ef4 commit 22602c4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

compiler-rt/lib/hwasan/hwasan_report.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,13 @@ void BaseReport::PrintAddressDescription() const {
586586
untagged_addr - heap.begin, d.Default());
587587
}
588588

589+
auto announce_by_id = [](u32 thread_id) {
590+
hwasanThreadList().VisitAllLiveThreads([&](Thread *t) {
591+
if (thread_id == t->unique_id())
592+
t->Announce();
593+
});
594+
};
595+
589596
// Check stack first. If the address is on the stack of a live thread, we
590597
// know it cannot be a heap / global overflow.
591598
for (uptr i = 0; i < stack_allocations_count; ++i) {
@@ -598,11 +605,7 @@ void BaseReport::PrintAddressDescription() const {
598605
Printf("Address %p is located in stack of thread T%zd\n", untagged_addr,
599606
allocations.thread_id());
600607
Printf("%s", d.Default());
601-
hwasanThreadList().VisitAllLiveThreads([&](Thread *t) {
602-
if (allocations.thread_id() == t->unique_id())
603-
t->Announce();
604-
});
605-
608+
announce_by_id(allocations.thread_id());
606609
PrintStackAllocations(allocations.get(), ptr_tag, untagged_addr);
607610
num_descriptions_printed++;
608611
}

0 commit comments

Comments
 (0)