1 // Test that MallocStackLogging=1 doesn't crash. MallocStackLogging turns on 2 // callbacks from mmap/munmap libc function into libmalloc. Darwin-specific 3 // ThreadState initialization needs to avoid calling the library functions (and 4 // use syscalls directly) to make sure other interceptors aren't called. 5 6 // RUN: %clangxx_tsan -O1 %s -o %t 7 // RUN: MallocStackLogging=1 %run %t 2>&1 | FileCheck %s 8 #include <pthread.h> 9 #include <stdlib.h> 10 #include <stdio.h> 11 12 void *foo(void *p) { 13 return NULL; 14 } 15 16 int main() { 17 pthread_t t; 18 pthread_create(&t, NULL, foo, NULL); 19 pthread_join(t, NULL); 20 fprintf(stderr, "Done.\n"); 21 return 0; 22 } 23 24 // CHECK: Done. 25