1// Check that the `atos` symbolizer works. 2 3// RUN: %clangxx_asan -O0 %s -o %t 4// RUN: ASAN_OPTIONS=verbosity=2 ASAN_SYMBOLIZER_PATH=$(which atos) not %run %t 2>&1 | FileCheck %s 5 6// Check that when having a DYLD_ROOT_PATH set, the symbolizer still works. 7// RUN: DYLD_ROOT_PATH="/" ASAN_OPTIONS=verbosity=2 ASAN_SYMBOLIZER_PATH=$(which atos) \ 8// RUN: not %run %t 2>&1 | FileCheck %s 9 10#include <stdlib.h> 11#include <string.h> 12int main(int argc, char **argv) { 13 char *x = (char*)malloc(10 * sizeof(char)); 14 memset(x, 0, 10); 15 int res = x[argc]; 16 free(x); 17 free(x + argc - 1); // BOOM 18 // CHECK: AddressSanitizer: attempting double-free{{.*}}in thread T0 19 // CHECK: Using atos at user-specified path: 20 // CHECK: #0 0x{{.*}} in {{.*}}free 21 // CHECK: #1 0x{{.*}} in main {{.*}}atos-symbolizer.cc:[[@LINE-4]] 22 // CHECK: freed by thread T0 here: 23 // CHECK: #0 0x{{.*}} in {{.*}}free 24 // CHECK: #1 0x{{.*}} in main {{.*}}atos-symbolizer.cc:[[@LINE-8]] 25 // CHECK: allocated by thread T0 here: 26 // CHECK: atos-symbolizer.cc:[[@LINE-13]] 27 return res; 28} 29