Structure of the entire application:
Current scenarios (working/not-working)
I tried to get the code-coverage of the 'low_level.so' shared library using the lcov/gcov from the above structure but was not successful, below are the steps tried and error seen:
Added "-fprofile-arcs" "-ftest-coverage" flags while compilation of 'low_level.so' library. And created the library.
Added "-coverage" option for the compilation of 'high_level.a' library. And created the library.
Added 'LFLAGS=-lgcov -coverage' for the Application Program (with 'main' function). And created the executable application.
Now when I tried to executed the above compiled application program, I get below error for dlopen: could not dlopen: /home/test/libXXX.so: undefined symbol: __gcov_merge_add
Questions?:
Note: All code is in 'C'.
FYI, I searched for the same and found some similar question, which was still lagging a selected best answer: How to find the coverage of a library opened using dlopen()? Also there was no good pointer on the net apart from the option of not using dlopen.
Thanks Mat for giving some input and thoughts.
Inline to that and doing some trial and error, I finally was able to solve the problem by adding the "-fprofile-arcs" and "-ftest-coverage" options as linker flags also in addition to compiler flags while compilation of 'low_level.so' library.