1// RUN: %clang_pgogen -o %t -g -mllvm --debug-info-correlate -mllvm --disable-vp=true %s
2// RUN: llvm-profdata show --debug-info=%t --detailed-summary --show-prof-sym-list | FileCheck %s
3// RUN: llvm-profdata show --debug-info=%t --show-format=yaml | FileCheck %s --match-full-lines --check-prefix YAML
4
5// RUN: %clang_pgogen -o %t.no.dbg -mllvm --debug-info-correlate -mllvm --disable-vp=true %s
6// RUN: not llvm-profdata show --debug-info=%t.no.dbg 2>&1 | FileCheck %s --check-prefix NO-DBG
7// NO-DBG: unable to correlate profile: could not find any profile data metadata in correlated file
8
9// YAML: Probes:
10// YAML: - Function Name: a
11// YAML: Linkage Name: a
12// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
13// YAML: Counter Offset: 0x0
14// YAML: Num Counters: 1
15// YAML: File: [[FILE:'.*']]
16// YAML: Line: [[@LINE+1]]
17void a() {}
18
19// YAML: - Function Name: b
20// YAML: Linkage Name: b
21// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
22// YAML: Counter Offset: 0x8
23// YAML: Num Counters: 1
24// YAML: File: [[FILE:'.*']]
25// YAML: Line: [[@LINE+1]]
26void b() {}
27
28// YAML: - Function Name: main
29// YAML: Linkage Name: main
30// YAML: CFG Hash: 0x[[#%.1X,HASH:]]
31// YAML: Counter Offset: 0x10
32// YAML: Num Counters: 1
33// YAML: File: [[FILE]]
34// YAML: Line: [[@LINE+1]]
35int main() { return 0; }
36
37// CHECK: a
38// CHECK-NEXT: b
39// CHECK-NEXT: main
40// CHECK: Counters section size: 0x18 bytes
41// CHECK: Found 3 functions
42

source code of compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c