1// Header
2//
3// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
5// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
6// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
7// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
8// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize,  NamesSize)
9// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
10// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
11// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
12
13RUN: printf '\201rforpl\377' > %t.profraw
14RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
15// There will be 2 20-byte binary IDs, so the total Binary IDs size will be 64 bytes.
16//   2 * 8  binary ID sizes
17// + 2 * 20 binary IDs (of size 20)
18// + 2 * 4  binary ID paddings
19// --------
20// = 64     bytes
21RUN: printf '\100\0\0\0\0\0\0\0' >> %t.profraw
22RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
23RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
24RUN: printf '\3\0\0\0\0\0\0\0' >> %t.profraw
25RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
26RUN: printf '\20\0\0\0\0\0\0\0' >> %t.profraw
27RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
28RUN: printf '\0\0\4\0\2\0\0\0' >> %t.profraw
29RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
30
31// Binary IDs - There are only two in this case that are 20 bytes.
32RUN: printf '\24\0\0\0\0\0\0\0' >> %t.profraw
33RUN: printf '\0\1\2\3\4\5\6\7' >> %t.profraw
34RUN: printf '\0\1\2\3\4\5\6\7' >> %t.profraw
35RUN: printf '\0\1\2\3\0\0\0\0' >> %t.profraw
36RUN: printf '\24\0\0\0\0\0\0\0' >> %t.profraw
37RUN: printf '\1\1\1\1\1\1\1\1' >> %t.profraw
38RUN: printf '\2\2\2\2\2\2\2\2' >> %t.profraw
39RUN: printf '\3\3\3\3\0\0\0\0' >> %t.profraw
40
41// Data Section
42//
43// struct ProfData {
44// #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
45//    Type Name;
46// #include "llvm/ProfileData/InstrProfData.inc"
47// };
48
49RUN: printf '\254\275\030\333\114\302\370\134' >> %t.profraw
50RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
51RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
52RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
53RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
54RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
55
56RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw
57RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
58RUN: printf '\xd8\xff\3\0\1\0\0\0' >> %t.profraw
59RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
60RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
61RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
62
63RUN: printf '\023\0\0\0\0\0\0\0' >> %t.profraw
64RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw
65RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw
66RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t.profraw
67
68// RUN: llvm-profdata show --binary-ids  %t.profraw | FileCheck %s
69// CHECK: Instrumentation level: Front-end
70// CHECK: Binary IDs:
71// CHECK-NEXT: 0001020304050607000102030405060700010203
72// CHECK-NEXT: 0101010101010101020202020202020203030303
73