diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp --- a/compiler-rt/lib/hwasan/hwasan_report.cpp +++ b/compiler-rt/lib/hwasan/hwasan_report.cpp @@ -560,8 +560,14 @@ Printf("%s", d.Error()); uptr pc = stack->size ? stack->trace[0] : 0; const char *bug_type = "invalid-free"; - Report("ERROR: %s: %s on address %p at pc %p\n", SanitizerToolName, bug_type, - untagged_addr, pc); + const Thread *thread = GetCurrentThread(); + if (thread) { + Report("ERROR: %s: %s on address %p at pc %p on thread T%zd\n", + SanitizerToolName, bug_type, untagged_addr, pc, thread->unique_id()); + } else { + Report("ERROR: %s: %s on address %p at pc %p on unknown thread\n", + SanitizerToolName, bug_type, untagged_addr, pc); + } Printf("%s", d.Access()); Printf("tags: %02x/%02x (ptr/mem)\n", ptr_tag, mem_tag); Printf("%s", d.Default()); diff --git a/compiler-rt/test/hwasan/TestCases/double-free.c b/compiler-rt/test/hwasan/TestCases/double-free.c --- a/compiler-rt/test/hwasan/TestCases/double-free.c +++ b/compiler-rt/test/hwasan/TestCases/double-free.c @@ -11,7 +11,7 @@ char * volatile x = (char*)malloc(40); free(x); free(x); -// CHECK: ERROR: HWAddressSanitizer: invalid-free on address +// CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{.*}} on thread T{{[0-9]+}} // CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem) // CHECK: freed by thread {{.*}} here: // CHECK: previously allocated here: