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// XFAIL: msvc
8
9#include <stdio.h>
10
11void foo() { fputs(s: "FOO", stderr); }
12void bar() { fputs(s: "BAR", stderr); }
13
14int main(int argc, char **argv) {
15 if (argc == 2) {
16 foo();
17 bar();
18 } else {
19 bar();
20 foo();
21 }
22}
23
24// CHECK: 0x{{[0-9a-f]*}}
25// CHECK: 0x{{[0-9a-f]*}}
26// CHECK: 0x{{[0-9a-f]*}}
27// CHECK-NOT: 0x{{[0-9a-f]*}}
28

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

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