[llvm-dev] How data is laid out in default.profraw when doing profiling?
xuruobin via llvm-dev
llvm-dev at lists.llvm.org
Wed May 15 20:26:39 PDT 2019
Hi all,
I'm now working on llvm-cov for a new target and have a problem here.
Because of some reasons, users do not stub in the main function and after running elf file, they cannot get a default profraw. Now they want to construct a default profraw manually but don't know how data is laid out in `default profraw` file.
We found a struct ProfDataIOVec in InstrProfilingWriter.c in compiler-rt and followed this layout.
```
ProfDataIOVec IOVec[] = {
{&Header, sizeof(__llvm_profile_header), 1},
{DataBegin, sizeof(__llvm_profile_data), DataSize},
{CountersBegin, sizeof(uint64_t), CountersSize},
{SkipNameDataWrite ? NULL : NamesBegin, sizeof(uint8_t), NamesSize},
{Zeroes, sizeof(uint8_t), Padding}};
```
This helped us successfully passed some small cases(not know for sure whether the coverage result is true, but we can see coverage report). But when we added more cases, `llvm-cov show -arch=xxx ...` gave us an assertion when entering fuction ` loadFunctionRecord ` in CoverageMapping.cpp. The OrigFuncName is empty when inserting into FunctionNames. Seems the llvm-cov cannot find a function name. I think it's because we didn't construct a correct default.profraw. So how data is laid out in default.profraw when doing profiling? Any help will be appreciated.
A small tip which may help. We are using coverage tool for a new target so when building compiler-rt, we use InstrProfilingPlatformOther.c
Best,
Ruobin
More information about the llvm-dev
mailing list