[compiler-rt] c097c25 - [HWASAN] Fix verbose_threads
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 20:56:39 PDT 2023
Author: Vitaly Buka
Date: 2023-06-09T20:56:23-07:00
New Revision: c097c2548eef944af9f5f454237ee807edc86ea7
URL: https://github.com/llvm/llvm-project/commit/c097c2548eef944af9f5f454237ee807edc86ea7
DIFF: https://github.com/llvm/llvm-project/commit/c097c2548eef944af9f5f454237ee807edc86ea7.diff
LOG: [HWASAN] Fix verbose_threads
Looks like D104248 acidentally moved the code.
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_thread.cpp
compiler-rt/test/hwasan/TestCases/verbose_threads.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.cpp b/compiler-rt/lib/hwasan/hwasan_thread.cpp
index a97b8e55f37cb..ce36547580e6e 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -59,6 +59,15 @@ void Thread::Init(uptr stack_buffer_start, uptr stack_buffer_size,
InitStackAndTls(state);
dtls_ = DTLS_Get();
AllocatorThreadStart(allocator_cache());
+
+ if (flags()->verbose_threads) {
+ if (IsMainThread()) {
+ Printf("sizeof(Thread): %zd sizeof(HeapRB): %zd sizeof(StackRB): %zd\n",
+ sizeof(Thread), heap_allocations_->SizeInBytes(),
+ stack_allocations_->size() * sizeof(uptr));
+ }
+ Print("Creating : ");
+ }
}
void Thread::InitStackRingBuffer(uptr stack_buffer_start,
@@ -80,15 +89,6 @@ void Thread::InitStackRingBuffer(uptr stack_buffer_start,
CHECK(MemIsApp(stack_bottom_));
CHECK(MemIsApp(stack_top_ - 1));
}
-
- if (flags()->verbose_threads) {
- if (IsMainThread()) {
- Printf("sizeof(Thread): %zd sizeof(HeapRB): %zd sizeof(StackRB): %zd\n",
- sizeof(Thread), heap_allocations_->SizeInBytes(),
- stack_allocations_->size() * sizeof(uptr));
- }
- Print("Creating : ");
- }
}
void Thread::ClearShadowForThreadStackAndTLS() {
diff --git a/compiler-rt/test/hwasan/TestCases/verbose_threads.c b/compiler-rt/test/hwasan/TestCases/verbose_threads.c
index 85afb4e9eae35..951bdc5dce556 100644
--- a/compiler-rt/test/hwasan/TestCases/verbose_threads.c
+++ b/compiler-rt/test/hwasan/TestCases/verbose_threads.c
@@ -1,4 +1,4 @@
-// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s --implicit-check-not=0x000000000000
// REQUIRES: stable-runtime
#include <pthread.h>
@@ -11,8 +11,8 @@
// CHECK: Creating : T0 0x[[#%x,T0:]] stack: [0x[[#%x,SB0:]],0x[[#%x,SE0:]]) sz: [[#]] tls: [0x[[#%x,TB0:]],0x[[#%x,TE0:]])
// CHECK: Creating : T1 0x[[#%x,T1:]] stack: [0x[[#%x,SB1:]],0x[[#%x,SE1:]]) sz: [[#]] tls: [0x[[#%x,TB1:]],0x[[#%x,TE1:]])
// CHECK: Creating : T2 0x[[#%x,T2:]] stack: [0x[[#%x,SB2:]],0x[[#%x,SE2:]]) sz: [[#]] tls: [0x[[#%x,TB2:]],0x[[#%x,TE2:]])
-// CHECK: Destroying: T2 0x[[#T2]] stack: [0x[[#%x,SB2:]],0x[[#%x,SE2:]]) sz: [[#]] tls: [0x[[#%x,TB2:]],0x[[#%x,TE2:]])
-// CHECK: Destroying: T1 0x[[#T1]] stack: [0x[[#%x,SB1:]],0x[[#%x,SE1:]]) sz: [[#]] tls: [0x[[#%x,TB1:]],0x[[#%x,TE1:]])
+// CHECK: Destroying: T2 0x[[#T2]] stack: [0x[[#SB2]],0x[[#SE2]]) sz: [[#]] tls: [0x[[#TB2]],0x[[#TE2]])
+// CHECK: Destroying: T1 0x[[#T1]] stack: [0x[[#SB1]],0x[[#SE1]]) sz: [[#]] tls: [0x[[#TB1]],0x[[#TE1]])
void *Empty(void *arg) {
if (arg) return NULL;
More information about the llvm-commits
mailing list