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