1

Is there a way for gcov to provide coverage analysis of a shared library without building the main() program that uses the shared library?

I have external users of the shared library that have their own executable programs that use the library and I need to test code coverage with those programs but I do not have access to their source code.

Surely somebody else has encountered this problem with gcov.

The main() and the shared library are written in C. For a main() program that I do have source code for I was able to use gcov just fine to get an execution trace of calls placed to the shared library.

I have not seen any examples where gcov is used without compiling and linking the main() program. Never the less I am asking this question with the hope somebody else has found a work around solution.

A similar question has also been posted on gcc-help.

  • Warren Ferguson
  • Im not clear about your query you can see this it might help http://stackoverflow.com/questions/18483168/using-gcov-with-shared-objects-used-by-executable/18487449#18487449 – vinay hunachyal Sep 05 '13 at 11:37
  • For the main() program all I have is an executable file. I do not have the source code for main(). For the example you mention, the source code for main() is available. – user2744447 Sep 05 '13 at 15:38
  • Is that main() program compiled with --coverage options? If yes, you can link it with -lgcov(or --coverage) and have coverage data. – ernesto Nov 20 '13 at 11:16

0 Answers0