I am trying to generate coverage report for my project. the .gcno files are generated as expected for the shared object code files, but when I run the executable (which uses the shared object generated), .so is also present in same location as executable but .gcda files for shared object doesnot get generated whereas .gcda files for executable code is generated as expected. Is there something wrong in approach? PLEASE ADVISE
Its possible to get coverage for shared libarary. i tried simple hello application profiling with gcov with shared library concept ,im able to get code coverage. let take two files hello.c and extlib.c
First compile extlib.c
}
gcc -shared -fPIC extlib.c -o libext.so -ftest-coverage -fprofile-arcshere will get extlib.gcno libextlib.so
next link it to main hello program //hello.c extern void print(const char*, ...);
gcc hello.c -L./ -lextlib -o test -ftest-coverage -fprofile-arcsafter this hello.gcno file. execute
./testAfter execution will get extlib.gcda and hello.gcda
using
gcov *.ccan check coverage.so my suggestion try some simple file in your project individually compiling it with gcov profiling.