1// Tests trace pc guard coverage collection.
2//
3// REQUIRES: x86_64-linux
4// XFAIL: tsan
5//
6// RUN: DIR=%t_workdir
7// RUN: rm -rf $DIR
8// RUN: mkdir -p $DIR
9// RUN: cd $DIR
10// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
11// RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
12// RUN: rm -rf $DIR
13
14#include <stdio.h>
15
16int foo() {
17 fprintf(stderr, format: "foo\n");
18 return 1;
19}
20
21int main() {
22 fprintf(stderr, format: "main\n");
23 foo();
24 foo();
25}
26
27// CHECK: main
28// CHECK: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov: 2 PCs written
29

source code of compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cpp