brintos

brintos / llvm-project-archived public Read only

0
0
Text · 668 B · 0a96e34 Raw
25 lines · cpp
1// Test that MallocStackLogging=1 doesn't crash. MallocStackLogging turns on2// callbacks from mmap/munmap libc function into libmalloc. Darwin-specific3// ThreadState initialization needs to avoid calling the library functions (and4// use syscalls directly) to make sure other interceptors aren't called.5 6// RUN: %clangxx_tsan -O1 %s -o %t7// RUN: env MallocStackLogging=1 %run %t 2>&1 | FileCheck %s8#include <pthread.h>9#include <stdlib.h>10#include <stdio.h>11 12void *foo(void *p) {13    return NULL;14}15 16int 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