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
5
votes
1 answer

Why is codecov with lcov not working correctly on Travis but on my local Linux Mint?

I tried to add Codecov to my CI build system for my library. The travis script looks like this: lcov --directory . --capture --output-file coverage.info --gcov-tool gcov-8 # capture coverage info lcov --remove coverage.info '/usr/*' --output-file…
AMS
  • 51
  • 1
  • 5
5
votes
2 answers

Generating test coverage of C++ static library as called by separate test classes

I am using QT Creator to work on a medium-sized project in C++. The project structure basically looks like this Project Group A Library A1 Group B Library B1 Library B2 ...etc Test LibA1_Test LibB1_Test LibB2_Test ...etc The libraries…
alayers2
  • 510
  • 5
  • 16
5
votes
1 answer

can gcov deal with shared object?

I am recently using gcov to collect the code coverage info. gcov plays well with executable application :) , but when I try to load a .so file, I got this error: unknown symbol __gcov_merge_add. Then I search on Google and someone said adding -lgcov…
maguschen
  • 765
  • 2
  • 8
  • 12
5
votes
1 answer

How do I unit-test a dynamic library using gcov?

I am building a dynamically-linked library, and am setting up a simple test suite. I want to use gcov to generate a static code analysis coverage report. My library is a C file containing function implementations and a header file containing…
Woodrow Barlow
  • 8,477
  • 3
  • 48
  • 86
5
votes
1 answer

iPhone: How can I use gcov?

I'm trying to use gcov on iPhone Project and followed Apple's instruction described here, but it doesn't work. When I build and go configured project, .gcda file is created for each object file. But no executed lines are recorded to .gcda files.…
taichino
  • 1,135
  • 1
  • 15
  • 30
5
votes
1 answer

Gcov reports branches for plain function calls

I'm using gcov to get code coverage for our project, but it frequently reports 50% conditional coverage for plain function calls. It doesn't make any difference if the function takes any parameters or returns any data or not. I'm using gcovr and…
MrDanne
  • 91
  • 1
  • 5
5
votes
2 answers

Output color code of Gcov with Cobertura

I have set gcov code coverage tools on Jenkins. This works fine, but I have troubles undertanding the ouput color code. The number of 'hits' of each line is corect, but some line are green when others are red, and I can't tell why. Example : Note…
MokaT
  • 1,416
  • 16
  • 37
5
votes
1 answer

Exclusion markers for gcov

I'm using gcov to measure coverage in my C++ code. I'd like to be able to mark certain lines of source code so that they are excluded from coverage reporting when using gcovr. I know they exist because I stumbled across them once but now I can't…
ksl
  • 4,519
  • 11
  • 65
  • 106
5
votes
0 answers

lcov doesn't match gcov coverage results for a googletest unit test

I'm trying to gather coverage results on a library file foobar.cpp by creating a googletest unit tests for the souce file and then using gcov for coverage results, finally using lcov to produce an html document. I've gotten unit testing and gcov…
user3407196
5
votes
1 answer

gcov generates empty coverage for c

I'm trying to collect code coverage for the project that has c++ and c code both on Ubuntu. I use '-fprofile-arcs' and '-ftest-coverage' values as CXXFLAGS and CFLAGS; '-lgcov' as LINKFLAGS. Common C project structure is: c_code\ src …
Evgeny
  • 159
  • 1
  • 10
5
votes
4 answers

No source code coverage color highlighting in eclipse-cpp-luna-SR1 for static library project

I'm using eclipse-cpp-luna-SR1 for both Linux and Windows with tool chain gcc 4.9.1 Code is partitioned into two projects: Production code in a static library project Properties|C/C++ Build|Settings|Debugging|Generate gcov information…
Harald
  • 240
  • 2
  • 10
5
votes
1 answer

How can I use "gcov" even when a segmentation fault happens?

I'm compiling a C program with flags "-Wall -W -pedantic -O0 --coverage" (GCC version 4.8.2). However when a segmentation fault happens on that program I can't extract the coverage, because I don't have the .gcda file... Does anyone know how can I…
josecampos
  • 851
  • 1
  • 8
  • 25
5
votes
2 answers

undefined reference to `__gcov_flush'

I am trying same, http://www.linuxforums.org/forum/suse-linux/135465-gcov-g.html Code from the link, #include using namespace std; void one(void); void two(void); void __gcov_flush(void); int main(void) { int i; while(true) { …
Vijay C
  • 4,739
  • 4
  • 41
  • 46
5
votes
2 answers

Linux Kernel Code Coverage - GCOV

I'm trying to use some test scenarios from Linux test Project and get the Kernel source code coverage. I'm using GCOV/LCOV to do so. here are the things I have so far: GCOV flags in the build config GCOV-based kernel…
Shayan
  • 548
  • 6
  • 24
5
votes
1 answer

The .gcda files not created when using gcov with cmake

I am using gcov with cmake. All the flags are set properly. .GCNO files are created properly. However, the situation is a little complex when executing the executables generated from the source files. The executables are run inside bash scripts. Let…
Bilal Ahmad
  • 322
  • 5
  • 11