GPS is fitted with a strong integration of Gcov, the GNU code coverage utility.
Code coverage information can be computed from, loaded and visualized in GPS. This can be done file by file, for each files of the current project, project by project (in case of dependencies) or for the entire project hierarchy currently used in GPS.
Once computed then loaded, the coverage information is summarized in a graphical report (shaped as a tree-view with percentage bars for each item) and used to decorate source code through mechanisms such as line highlighting or coverage annotations.
All the coverage related operations are reachable via the Tools->Coverage menu.
In order to be loaded in GPS, the coverage information need to be computed before, using the Tools->Coverage->Gcov->Compute coverage files menu for instance.
At each attempt, GPS automatically tries to load the needed information and reports errors for missing or corrupted .gcov files.
To be able to produce coverage information from Gcov, your project must have been compiled with the -fprofile-arcs and -ftest-coverage" switches, respectively "Instrument arcs" and "Code coverage" entries in The Project Properties Editor, and run once.
XXX
XXX
.
These submenus contain the following entries, adapted to the context related element. For instance, if you click on a file, you will have:
This report contains a tree of Projects, Files and Subprograms with corresponding coverage information for each node in sided columns.
The contextual menus generated on this widget contain, in addition to the regular entries, some specific Coverage Report entries.
These entries allow you to expand or fold the tree, and also to display flat lists of files or subprograms instead of the tree. A flat list of file will look like:
GPS and Gcov both support many different programming languages, and so code coverage features are available in GPS for many languages. But, note that subprogram coverage details are not available for every supported languages.
To finish, note that if you change the current main project in GPS, using the Project->Open menu for instance, you will also drop every loaded coverage information as they are related to the working project.