Questions tagged [gcov]

gcov is a code coverage tool for GCC

gcov allows you to analyze which parts of a program are not executed. This is interesting for example in order to know which part of a program are not tested. gcov also serves for profiling purposes.

gcov requires additional flags to be passed to GCC in order to generate a special version of a program. This version shouldn't be shipped because it is slower as it generates coverage data files.

575 questions
11
votes
1 answer

How to make lcov perform faster?

I'm having performance issues with lcov. I'm executing a program in seven different profiles, collecting the coverage for each of them and then merging the coverage profile with lcov: lcov --rc lcov_branch_coverage=1 -a coverage_1.dat -a…
Baptiste Wicht
  • 7,472
  • 7
  • 45
  • 110
11
votes
1 answer

How can I get more accurate results from gcov?

I'm experimenting with gcov using mingw gcc 4.4.0. I've been getting some interesting but strange results. A common pattern is something like this... 5162: 66: std::string::iterator i = l_Temp.begin (); 5162: 67: …
user180247
11
votes
2 answers

Why is gcov creating Code Coverage data for STL Headers?

When I run gcov foo.cpp it not only generates the code coverage report for foo.cpp, but for all the STL headers used by foo.cpp. Is there a way to prevent this? It seems to ignore standard library headers like . Edit Just ran across this…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
11
votes
3 answers

Is there a way to call the "deleting destructor" of a pure virtual class?

I'm using C++11 and g++4.8 on Ubuntu Trusty. Consider this snippet class Parent { public: virtual ~Parent() = default; virtual void f() = 0; }; class Child: public Parent { public: void f(){} }; Called using { Child o; …
rcomblen
  • 4,579
  • 1
  • 27
  • 32
11
votes
3 answers

Code coverage using gcov on parallel run

I have C/C++ code coverage setup with gcov for several files in the project. The executables are being run in parallel. This results in some shared piece of code to be run in parallel. I am getting corrupt .da files or zero sized .da files. Is this…
Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69
11
votes
1 answer

Is there a tool for converting the Emma XML reports to Cobertura XML format?

I am using a code coverage tool that can only generate Emma XML report, while what I need is Cobertura or gcov format. Does there already exist some tool for doing the conversion? If not, I'm afraid I must do it myself.
tomsheep
  • 253
  • 1
  • 3
  • 7
10
votes
3 answers

Is there a way to merge two .gcda files into one?

I have several unit tests for an application, each of which is capable of generating .gcda files. I would like to be able to generate unified .gcda files which represent the coverage of my test suite as a whole. There doesn't appear to be an easy…
Kanak
  • 101
  • 1
  • 3
10
votes
1 answer

Understand control flow graph in lcov branch coverage output

I am trying to improve my unit tests by inspecting my current code coverage percentage. I am using gcov and lcov to produce a HTML report of the coverage results. However, I am having problems understanding some of the output. I know that a +…
sigy
  • 2,408
  • 1
  • 24
  • 55
10
votes
2 answers

CMake Gcov c++ creating wrong .gcno files

I have a CMakeLists.txt file in which I added: set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -pthread -std=c++11 -O0 ${CMAKE_CXX_FLAGS}") It is generating the report files in: project_root/build/CMakeFiles/project.dir/ BUT the files it…
fedest
  • 1,190
  • 3
  • 15
  • 35
10
votes
2 answers

Libtool prefixes objects but gcov requires them without prefix

I need to perform some test coverage with gcov on a shared library I am working on. The problem is libtool renames the object files from my-name.c to libmylib_la-my-name.lo and gcov is unable to handle that conversion. Everytime I run it, the error…
ntd
  • 7,372
  • 1
  • 27
  • 44
10
votes
2 answers

code coverage with gcovr and Xcode 5 is not working

I'm using gcovr to generate code coverage for cobertura. Everything was working fine with xcode 4.6. Now I updated to xcode5 and everything I get is 0% coverage... my setup: gcovr 3.0 Xcode 5 (Apple LLVM 5) 'Generate Test Coverage Files' is set…
Alex
  • 142
  • 2
  • 9
10
votes
5 answers

Is there any actively supported lcov port for windows

I measure coverage for my code using gcov library and I would like to generate coverage report in user-friendly format. I've found lcov utility for that, but it's not compatibile with Windows environment (mainly because of the way the paths are…
chalup
  • 8,358
  • 3
  • 33
  • 38
9
votes
1 answer

gcov and global destructors

MWE #include struct Foo { Foo() { std::cout << "Constructing Foo " << this << std::endl; } ~Foo() { std::cout << "Destructing Foo " << this << std::endl; } }; Foo global_foo; int main () { std::cout << "Entering and…
David Hammen
  • 32,454
  • 9
  • 60
  • 108
9
votes
3 answers

gcov on larger projects (static libraries, ...)

I'm working on larger project which has the following directory layout: Source MyA aa.cpp ab.cpp ac.cpp MyB ba.cpp bb.cpp bc.cpp MyTest testaa.cpp testab.cpp testac.cpp testba.cpp testbb.cpp testbc.cpp main.cpp Build …
azraiyl
  • 343
  • 2
  • 4
  • 11
9
votes
2 answers

Xcode 7 generating GCOV

so the hot new feature in Xcode 7 is code coverage integrated within XCode - yaaay! With this new feature also comes Apple's new code coverage format .profdata. We need to display code coverage reports in Cobertura reports (loaded in Jenkins).…
1 2
3
38 39