[compiler-rt] 5914ae3 - [test][HWASAN] Add verbose_threads test
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 20:33:57 PDT 2023
Author: Vitaly Buka
Date: 2023-06-09T20:33:39-07:00
New Revision: 5914ae340c753b74c1bc59b740d0a4b3b1994cb6
URL: https://github.com/llvm/llvm-project/commit/5914ae340c753b74c1bc59b740d0a4b3b1994cb6
DIFF: https://github.com/llvm/llvm-project/commit/5914ae340c753b74c1bc59b740d0a4b3b1994cb6.diff
LOG: [test][HWASAN] Add verbose_threads test
Added:
compiler-rt/test/hwasan/TestCases/verbose_threads.c
Modified:
Removed:
################################################################################
diff --git a/compiler-rt/test/hwasan/TestCases/verbose_threads.c b/compiler-rt/test/hwasan/TestCases/verbose_threads.c
new file mode 100644
index 0000000000000..85afb4e9eae35
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/verbose_threads.c
@@ -0,0 +1,30 @@
+// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s
+// REQUIRES: stable-runtime
+
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <sanitizer/hwasan_interface.h>
+
+// CHECK: sizeof(Thread): [[#]] sizeof(HeapRB): [[#]] sizeof(StackRB): [[#]]
+// 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:]])
+
+void *Empty(void *arg) {
+ if (arg) return NULL;
+ pthread_t t;
+ pthread_create(&t, NULL, Empty, &t);
+ pthread_join(t, NULL);
+ return NULL;
+}
+
+int main() {
+ pthread_t t;
+ pthread_create(&t, NULL, Empty, NULL);
+ pthread_join(t, NULL);
+ return 0;
+}
More information about the llvm-commits
mailing list