No source code coverage color highlighting in eclipse-cpp-luna-SR1 for static library project

1.8k views Asked by At

I'm using eclipse-cpp-luna-SR1 for both Linux and Windows with tool chain gcc 4.9.1
Code is partitioned into two projects:

  • Production code in a static library project
    Properties|C/C++ Build|Settings|Debugging|Generate gcov information (-ftest-coverage -fprofile-arcs)
    is enabled
  • Client/Test code in an executable project
    Also Generate gcov information is enabled

Running the program from the executable project with
Profiling Tools|Profile Code Coverage
works fine, and the result is presented in the gcov tab with coverage information (Coverage %) from all source code files residing in the executable project as well as the static library project.
When examining source files from executable project the color highlighting works fine, but not at all for the source files residing in the static library project - i.e., no highlighting at all!
I've tried out on both Linux as well as Windows: Same behavior
In previous versions of eclipse-cpp, like Juno (4.2) and Kepler (4.3), the highlighting works fine for source files in a static library.

Any clue?

4

There are 4 answers

1
user3567678 On

Maybe this helps: If source code is included in a project via linked folders (but is actually located outside the procjet's root directory), code coverage using gcov does not highlight any code, although the coverage information is correct.

Maybe you've done the same or something similar with your library code when switching to Luna SR1, as previous eclipse versions (as far as I know) did not support that kind of relative folder linking..?

0
VladG On

I got it working by copying the executable file into the static library project output folder (e.g. Debug - I'm using managed build) next to the .a file. Now double-click on a .gcda file for a source file in the static library and choose the copied binary, select all coverage and voila, gcov highlighting is now shown in the editor.

0
Reetesh Ranjan On

There is an eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=439260 regarding this. I have seen this issue in Mars and Neon as well.

In case it helps, I tried to use lcov and genhtml as an alternative to eclipse visualization.

0
jesus denazaret On

I've tried using lcov and genhtml as it says in Link (under cygwin enviroment)

The process generates a file named ex_test.info.

As user3567678 says, if the file is in a path that is not the project one, the code coverage fails.

But, editing the ex_test.info I've seen that the "conflicting" files are determined by a path like this.

SF:/cygdrive/e/.../project_folder/E:/..../other_path/conflicting_file.c

so I renamed to:

SF:/cygdrive/e/..../other_path/conflicting_file.c

and the tried the genhtml again. And the process generate the html summary without issues.

SO, I assume that the code coverage tool integrated by eclipse is not the problem, but the tools under it.