1// RUN: rm -rf %t-dir
2// RUN: mkdir %t-dir && cd %t-dir
3// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o test.exe
4// RUN: %env_asan_opts=coverage=1 %run ./test.exe
5//
6// RUN: %sancov print *.sancov | FileCheck %s
7
8#include <stdio.h>
9
10void foo() { fputs(s: "FOO", stderr); }
11void bar() { fputs(s: "BAR", stderr); }
12
13int main(int argc, char **argv) {
14 if (argc == 2) {
15 foo();
16 bar();
17 } else {
18 bar();
19 foo();
20 }
21}
22
23// CHECK: 0x{{[0-9a-f]*}}
24// CHECK: 0x{{[0-9a-f]*}}
25// CHECK: 0x{{[0-9a-f]*}}
26// CHECK-NOT: 0x{{[0-9a-f]*}}
27

source code of compiler-rt/test/asan/TestCases/Windows/coverage-basic.cpp