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
6
votes
2 answers

How to use gcov with QMake for code coverage

I would like to use gcov with my unit test written using QTestLib. I have managed to generate some .gcno files along my object files by adding this to my .pro file : QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0 But, when I run : gcov…
Symbiosoft
  • 4,681
  • 6
  • 32
  • 46
6
votes
1 answer

configuring code coverage with cmake

I'm on a linux machine, trying to build a project using cmake that does out of source builds. For code coverage, I looked into gcov and followed a simple tutorial that generate appropriate files for a sample helloWorld.cpp program. The only…
Abhinav Gauniyal
  • 7,034
  • 7
  • 50
  • 93
6
votes
1 answer

How do I generate coverage reports for fork()'d children using gcov/lcov?

I'm having trouble generating coverage reports for a project of mine -- it seems that the lines in the child process after a fork are never hit, althought they clearly are in reality. Here is the coveralls report of the forking part (The results are…
Snaipe
  • 1,191
  • 13
  • 25
6
votes
1 answer

How to merge multiple versions of gcda files?

I'm using gcov for get coverage information of my application. However, there are 3 instances of my applications are running concurrently creating 3 versions of "gcda" files. Is there a way to merge different versions of same "gcda" files in my…
Sujith Gunawardhane
  • 1,251
  • 1
  • 10
  • 24
6
votes
2 answers

Processing gcov data files for tracing purposes

I'm trying to create a tool similar to TraceGL, but for C-type languages: As you can see, the tool above highlights code flows that were not executed in red. In terms of building this tool for Objective-C, for example, I know that gcov (and…
Dany Joumaa
  • 2,030
  • 6
  • 30
  • 45
6
votes
5 answers

How to exclude lcov branches within a macro

I've got some logging macros in my code along the lines of: #define LOG_MSG (pri, msg, ... ) \ if (pri > PriorityLevel ) \ printf( msg, ##\__VA_ARGS__); I know I can use LCOV_EXCL_START, LCOV_EXCL_STOP or LCOV_EXCL_LINE to suppress a…
perogiex
  • 505
  • 5
  • 10
6
votes
1 answer

How to set up gcov for code coverage analysis in iPhone SDK?

I've recently begun unit testing an app I write for the iPhone. I have the basics of creating my own tests down, even if it seems a little sub-optimal. I am, however, having real trouble setting up code coverage analysis using gcov. I followed the…
refulgentis
  • 2,624
  • 23
  • 37
6
votes
4 answers

Run gcov tool on folder

I run gcov tool on some .c files using gcc -fprofile-arcs -ftest-coverage [filenames]. command But its is very tedious job of supplying file names to this command. Instead I need help in which I can run gcov tool on a folder which contains all…
Coding Master
  • 767
  • 1
  • 7
  • 12
6
votes
3 answers

Can GCov be used in windows?

Can I install gcov tool in windows? Or can I take plug-in of this tool in eclipse in windows? I am very new to this tool. I don't have any idea about this tool. Please help me to get the information of this tool. please tell me the requirements to…
Coding Master
  • 767
  • 1
  • 7
  • 12
6
votes
2 answers

How to prevent Waf from renaming object files?

I am using Waf to build a C project and gcov to have some test code coverage. However, Waf calls gcc in a way that produces foo.c.1.o from source file foo.c that confuses gcov when searching for the generated files: $ gcov foo.c $ foo.gcno:cannot…
matthias
  • 2,161
  • 15
  • 22
6
votes
2 answers

Bjam for gcov coverage analysis?

I am looking to integrate a non-trivial cross-platform build system for a project predominately written in C++. I've evaluated Cmake and Scons, so far, and while they both represent an improvement over (GNU) make, neither approach seemed either…
aSteve
  • 1,956
  • 1
  • 20
  • 35
5
votes
1 answer

GCOV Version mismatch - expected 700e got 408R

On one server with GCC 4.4.7/GCOV 4.4.7, I'm able to run the tests successfully. However on a different server with GCC 4.8.5/GCOV 4.8.5, running the tests results in this error: profiling:/path/to/foo.gcda:Version mismatch - expected 700e got…
Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
5
votes
1 answer

gcov final link failed

While compiling my project with gcov support I am facing the below error Following are flags information i have while compiling compiler flags: CXXFLAGS="-Wno-deprecated -g -ggdb -fprofile-arcs -ftest-coverage -fPIC" linker options: LINK_CMD="gcc…
5
votes
2 answers

When I compile my code with clang, gcov throws out of memory error

I am trying to set up a basic project, and I want to use gcov. When I use g++, it works: g++ main.cpp whatever.cpp -fprofile-arcs -ftest-coverage The output of gcov is OK: gcov main.gcno main.gcda:cannot open data file, assuming not executed File…
Serban Stoenescu
  • 3,136
  • 3
  • 22
  • 41
5
votes
1 answer

Linking LLVM causes gcov to fail

Passing --coverage to gcc while also linking LLVM causes an undefined reference to `__gcov_exit' error from the linker. I've set up a fresh project to try to isolate this problem. You can view the source on github and inspect the compiler output on…
Indiana Kernick
  • 5,041
  • 2
  • 20
  • 50