Hey Daniel,
Does gcov support shared libraries now? I'm using gcc 4.5.1. I've found conflicting reports elsewhere.
I was just doing a very simple test using version 4.5 and it is working
correctly when using shared libraries. The .gcda files are generated for
both, the executable and the shared library ...
gcov data files (.gcda) are produced for my test program, but not for the shared library it is testing. Everything compiles fine though and the .gcno files are produced for both the test program and the shared library. Also, if I compile all of the source files (those from the library and those from the test program) into one executable, the .gcda files are produced correctly. Is there any way to make it work with a shared library?
The only thing that I could think of is that your shared library was
build in a different directory than the one you are running your
executable. By default, the --coverage option will embed the final
*.gcda filename into the excutable or shared library. E.g.
# strings liblib.so | grep gcda
/devel/gcc/sandbox/lib.gcda
Are the files written to the embedded file?
Fortunately, there's a way to overwrite the default file path. Please
check
http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html#Cross_002dprofiling
for the GCOV_PREFIX environment variable.
Hope that helps. If not, please let us know ...
Andi