[LLVMdev] Coverage mapping issue: Malformed profile data
Dmitry Volyntsev
xeioexception at gmail.com
Tue Feb 10 07:15:32 PST 2015
Hi all!
It seems I came across on issue with coverage mapping
(http://www.llvm.org/docs/CoverageMappingFormat.html)
check on:
llvm revision: r228136
clang Last Changed Rev: 228121
build: Debug+Asserts
OS: ubuntu 14.04
Here is simple snippets
test1.c: NOT OK
==================
#include <stdio.h>
static int foo() { return 42; }
int main() {
return 0;
}
==================
cp src/test1.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata
error: Failed to load coverage: Malformed profile data
test2.c: OK
==================
#include <stdio.h>
static int foo() { return 42; }
int main() {
return foo();
}
==================
cp src/test2.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata
/home/xeioex/workspace/clang/experiments/llvm-cov/test/src/test.c:
| 1|#include <stdio.h>
| 2|
1| 3|static int foo() { return 42; }
1| 4|int main() {
1| 5| return foo();
1| 6|}
test3.c: OK
==================
#include <stdio.h>
int foo() { return 42; }
int main() {
return 0;
}
==================
cp src/test3.c src/test.c; rm -fr default.profraw test.profdata ;
clang -c -o obj/test.o src/test.c -I -g -O0 -fprofile-instr-generate
-fcoverage-mapping; clang -o bin/test obj/test.o -I -g -O0
-fprofile-instr-generate -fcoverage-mapping; ./bin/test ;
llvm-profdata merge -o test.profdata default.profraw; llvm-cov show
./bin/test -instr-profile=test.profdata
/home/xeioex/workspace/clang/experiments/llvm-cov/test/src/test.c:
| 1|#include <stdio.h>
| 2|
0| 3|int foo() { return 42; }
1| 4|int main() {
1| 5| return 0;
1| 6|}
As far I can understand issue somehow related to unused static functions.
Also, as I can track down the problem raised because of
lib/ProfileData/CoverageMappingReader.cpp (SectionData::get) expects
that function's names located inside __llvm_prf_names section but it
not true in case of test1.c, instead some function names located
inside .rodata section.
Is it known issue?
any hints, how to avoid or workaround it?
--
Be happy,
Best regards,
Dmitry Volyntsev
More information about the llvm-dev
mailing list