diff options
author | Kuba Mracek <mracek@apple.com> | 2017-04-17 18:17:38 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-04-17 18:17:38 +0000 |
commit | 0f9f15db742f9abe6141df0819cd0fd577c06a3d (patch) | |
tree | 3720c792c577c29d1369fec7c88842dd6a57f563 /test/tsan/debug_alloc_stack.cc | |
parent | 9e60082e3f68e8619ffc917bbdaaf0636c3fcaa3 (diff) |
[sanitizer] Introduce tid_t as a typedef for OS-provided thread IDs
We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD).
Differential Revision: https://reviews.llvm.org/D31774
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/debug_alloc_stack.cc')
-rw-r--r-- | test/tsan/debug_alloc_stack.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/tsan/debug_alloc_stack.cc b/test/tsan/debug_alloc_stack.cc index 303c10320..ffe99e73a 100644 --- a/test/tsan/debug_alloc_stack.cc +++ b/test/tsan/debug_alloc_stack.cc @@ -15,7 +15,7 @@ #endif extern "C" int __tsan_get_alloc_stack(void *addr, void **trace, size_t size, - int *thread_id, void *os_id); + int *thread_id, uint64_t *os_id); char *mem; void alloc_func() { mem = (char *)malloc(10); } @@ -49,7 +49,7 @@ int main() { void *trace[100]; size_t num_frames = 100; int thread_id; - void *thread_os_id; + uint64_t *thread_os_id; num_frames = __tsan_get_alloc_stack(mem, trace, num_frames, &thread_id, &thread_os_id); @@ -58,7 +58,7 @@ int main() { // CHECK: alloc stack retval ok fprintf(stderr, "thread id = %d\n", thread_id); // CHECK: thread id = 1 - fprintf(stderr, "thread os id = 0x%llx\n", (uint64_t)thread_os_id); + fprintf(stderr, "thread os id = 0x%llx\n", thread_os_id); // CHECK: thread os id = [[THREAD_OS_ID]] fprintf(stderr, "%p\n", trace[0]); // CHECK: [[ALLOC_FRAME_0:0x[0-9a-f]+]] |