Results 1 to 2 of 2
Hi,
I am using gcov to get code coverage for my program written in C++, I am able to do it without any problem when i don't have a directory ...
- 09-14-2010 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 1
Using gcov
Hi,
I am using gcov to get code coverage for my program written in C++, I am able to do it without any problem when i don't have a directory structure, for my program I have a directory structure as below
Code:./src/ -- containing all my source files ./obj/ -- containing all my object files ./header/ -- containing all my header files ../../lib/ -- containing a static library, which will be used by my program there is a makefile in the current directory which creates my executable
Kindly help on how use gcov in this situation.do i need to compile the static library also with the options of gcov i.e. -fprofile-arcs -ftest-coverage, because it is the library that i need to check for coverage.
- 09-14-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
See the --opject-directory option for gcov. You can tell it where your object and source files are with that. There is also the --preserve-paths argument so it will use the complete path information when creating the profiles. From the gcov man page:
Code:--preserve-paths Preserve complete path information in the names of generated .gcov files. Without this option, just the filename component is used. With this option, all directories are used, with / characters translated to # characters, . directory components removed and .. components renamed to ^. This is useful if sourcefiles are in several different directories. It also affects the -l option.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote