Vedant Kumar | c7ec51a | 2019-10-15 17:53:48 +0000 | [diff] [blame^] | 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, DataSize, DataSize) |
| 6 | // INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize) |
| 7 | // INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize) |
| 8 | // INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin) |
| 9 | // INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin) |
| 10 | // INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last) |
| 11 | |
| 12 | RUN: printf '\201rforpl\377' > %t.profraw |
| 13 | RUN: printf '\4\0\0\0\0\0\0\0' >> %t.profraw |
| 14 | RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw |
| 15 | RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw |
| 16 | RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw |
| 17 | RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw |
| 18 | RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw |
| 19 | RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw |
| 20 | |
| 21 | // Data Section |
| 22 | // |
| 23 | // struct ProfData { |
| 24 | // #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \ |
| 25 | // Type Name; |
| 26 | // #include "llvm/ProfileData/InstrProfData.inc" |
| 27 | // }; |
| 28 | |
| 29 | RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw |
| 30 | RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw |
| 31 | |
| 32 | // Note: The CounterPtr here is off-by-one. |
| 33 | // |
| 34 | // Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters, |
| 35 | // the profile reader should error out. |
| 36 | RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw |
| 37 | |
| 38 | RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw |
| 39 | RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw |
| 40 | RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw |
| 41 | |
| 42 | // Counter Section |
| 43 | |
| 44 | RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw |
| 45 | RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw |
| 46 | |
| 47 | // Name Section |
| 48 | |
| 49 | RUN: printf '\3\0bar\0\0\0' >> %t.profraw |
| 50 | |
| 51 | RUN: not llvm-profdata merge -o /dev/null %t.profraw 2>&1 | FileCheck %s |
| 52 | CHECK: Malformed instrumentation profile data |