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
#include <stdio.h>
extern void print(const char* p, ...);
void print(const char* p, ...) {
printf("%s World!
", p);
}
gcc -shared -fPIC extlib.c -o libext.so -ftest-coverage -fprofile-arcs
here will get extlib.gcno libextlib.so
next link it to main hello program
//hello.c
extern void print(const char*, ...);
int main() {
print("Hello");
}
gcc hello.c -L./ -lextlib -o test -ftest-coverage -fprofile-arcs
after this hello.gcno file.
execute ./test
After execution will get extlib.gcda and hello.gcda
using gcov *.c
can check coverage.
so my suggestion try some simple file in your project individually compiling it with gcov profiling.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…