gcov

lcov or gcov -- how to large project analyze

I have large project to analyse. How to use gcov or lcov for it. I found plenty of document for gcov for a single C file. Not much document about lcov too. I'll be thankful for any pointers or tips or links ...

gcov line count is different from no of lines in source code

output of gcov says no of lines executed 70 % of 10 but my code has more than 10 lines.. it does not count braces , else statement please help .. ...

gcov and switch statements

I'm running gcov over some C code with a switch statement. I've written test cases to cover every possible path through that switch statement, but it still reports a branch in the switch statement as not taken and less than 100% on the "Taken at least once" stat. Here's some sample code to demonstrate: #include "stdio.h" void foo(int ...

Autotools automatic invocation of lcov after 'make check'

I have successfully set up an autotools project where the tests compiles with instrumentation so I can get a test coverage report. I can get the report by running lcov in the source dir after a successful 'make check'. I now face the problem that I want to automate this step. I would like to add this to 'make check' or to make it a sep...

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 <ctime>. Edit Just ran across this post on the gcc mailing list: Re: gcc, gcov and STL ...

How can I run Gcov over an installed Cocoa application?

I have a Cocoa application which uses an installer. I want to be able to run code coverage over the code (after it has been installed). This is not the usual unit-test scenario where a single binary will run a suite of tests. Rather, the tests in question will interact with the UI and the app back-end whilst it is running, so I ideally ...

How to setup environment variables for gcov on iPhone

I have overcome all problems with setting up gcov on my iPhone project but now I am getting the following: profiling:/Users:Cannot create directory Does anyone have any suggestions as to what I might be doing wrong? I originally setup gcov following Google's instructions which can be found by Googling "UsingCoverStory" UPDATE: Okay, ...

Excluding certain functions from gcov/lcov coverage results

Is it possible to exclude certain functions or lines of code from the gcov coverage analysis. My code contains certain functions that are used for debugging, and are not exercised as part of my test suite. Such functions reduce the coverage percentage reported by gcov. I would like to exclude these functions from the results. If it is no...

With gcov, is it possible to merge to .gcda files?

I have the same source files (C and Obj-C) being compiled into two targets: the unit test executable and the actual product (which then gets integration tested). The two targets build into different places, so the object files, .gcno and .gcda files are separate. Not all source files are compiled into the unit test, so not all objects wi...

Is it normal for gcov to peg the CPU at 100%

I'm running gcov (through lcov) over a medium-sized project. It's had the CPU at close to 100% for quite a while (not sure exactly how long, but over 30 minutes). The memory isn't ballooning. It seems to be stuck on one task. Is it normal for gcov to do this kind of thing? Edit No luck. Just had to exclude the piece of code that corre...

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. (CoverStory shows all coverages are 0%) I just added a simple class to template project as...

gcov does not generate coverage files

I am cross compiliing my executable for coverage using -fprofile-arcs -ftest-coverage flags on a 32 bit machine . And the resulting executable I am running it on target machine which is 64-bit. When I run the executable it does not generate .bb .bbg and .da files. What can be the reason for it. ...

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: std::string::iterator j = l_Temp.end () - 1; -: 68: char ch; -: 69: 20564: 70: wh...

How do I tell gcov to ignore un-hittable lines of C++ code?

I'm using gcov to measure coverage in my C++ code. I'd like to get to 100% coverage, but am hampered by the fact that there are some lines of code that are theoretically un-hittable (methods that are required to be implemented but which are never called, default branches of switch statements, etc.). Each of these branches contains an a...

Linker errors for gcov in Xcode

When adding gcov to an Xcode project, I'm getting linker errors: the symbols __gcov_init and __gcov_merge_add are not found. This is on Mac OS X 10.5 and Xcode 3.1.4, it's a Quartz Composer Plugin project and I'm trying to add gcov to the OCUnit test cases target. The Base SDK and Deployment Target are both set to Mac OS X 10.5. The GC...

can gcov deal with shared object?

Hi, All 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 to the link flag(LDFLAGS), I did add this option and it didn't work. I also try ...

gcov: producing .gcda output from shared library?

Is it possible to produce gcov data files (.gcda files) by running an executable linked to a shared library built with the --coverage option? Basically, I have the main library consisting of multiple c++ files compiled into one shared library and then a subdirectory called "test" containing a test program that links to and tests the mai...

GCov and GCC, *.da Files Not Created

I am using GCC version 3.3.6. When I instrument my object files with -fprofile-arcs and -ftest-coverage, the appropriate *.bb and *.bbg files are created. The object files are then linked together into a static library libfoo.a with: ar rcs libfoo.a foo1.o foo2.o. Finally, a series of static libraries are linked together to create my ...