So I've checked out and built the clang trunk by following these instructions http://clang.llvm.org/get_started.html. I can build my binary with --coverage and run it to get the .gcno and .gcda files, but when I run lcov I get "GENINFO: ... reached unexpected end of file".
Now I'm stuck and came to SO to look for help :)
I'm working with Ubuntu 13.04 and writing c++11, just in case that makes a difference.
LCOV is a graphical tool for GCC's coverage testing with gcov. It creates HTML pages containing the source code annotated with coverage information by collecting gcov data from multiple source files. LCOV supports “Lines coverage” and “Functions coverage” measurement.
Gcov is a source code coverage analysis and statement-by-statement profiling tool. Gcov generates exact counts of the number of times each statement in a program is executed and annotates source code to add instrumentation. Gcov comes as a standard utility with the GNU Compiler Collection (GCC) suite.
Region coverage is the percentage of code regions which have been executed at least once. A code region may span multiple lines (e.g in a large function body with no control flow). However, it is also possible for a single line to contain multiple code regions (e.g in “return x || y && z”).
Clang: a C language family frontend for LLVM. The Clang project provides a language front-end and tooling infrastructure for languages in the C language family (C, C++, Objective C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
I had the same problem with clang with lcov on Ubuntu 13.04. Here is the solution which worked for me on more than one Ubuntu setup.
This should generate the code coverage report.
EDIT: Mine was a upgrade from Ubuntu 12.04 to 13.04. Just in case you don't see two versions of gcov.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With