1// Check that ASan can print reproducer cmdline for failed binary if desired.
2//
3// RUN: %clang_asan %s -o %t-exe
4//
5// RUN: env not %run %t-exe 2>&1 | FileCheck %s
6// RUN: %env_asan_opts=print_cmdline=false not %run %t-exe 2>&1 | FileCheck %s
7// RUN: %env_asan_opts=print_cmdline=true not %run %t-exe first second/third [fourth] 2>&1 | FileCheck %s --check-prefix CHECK-PRINT
8
9volatile int ten = 10;
10
11int main() {
12 char x[10];
13 // CHECK-NOT: Command:
14 // CHECK-PRINT: {{Command: .*-exe first second/third \[fourth\]}}
15 x[ten] = 1; // BOOM
16 return 0;
17}
18
19

source code of compiler-rt/test/asan/TestCases/Posix/print_cmdline.cpp