[LLVMbugs] [Bug 22531] New: Coverage mapping: Malformed profile data

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 10 10:49:07 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22531

            Bug ID: 22531
           Summary: Coverage mapping: Malformed profile data
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xeioexception at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Environment+Setup:
llvm revision: r228136
clang  Last Changed Rev: 228121
build: Debug+Asserts
OS: ubuntu 14.04


Steps to Reproduce: 

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|}


Preliminary investigations:
AFAICU, the issue somehow related to the unused non-void static functions.

The error raised because of llvm/lib/ProfileData/CoverageMappingReader.cpp
(SectionData::get) expects that function names are located inside
__llvm_prf_names section but it not true in case of test1.c, instead some of
the function names are located inside .rodata section.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150210/bdae26d9/attachment.html>


More information about the llvm-bugs mailing list