Import gcc code coverage data from a project
Previously, and for older compilers, if you launched a code coverage-enabled build process and chose to disable code coverage in the launch configuration, the process wrote the coverage information to a data file (.gcda) at run time, rather than read it from the process's data space. This meant that you could choose to import this data into the Code Coverage tool at a later time. The newer gcc compiler doesn't stream the data coverage; the IDE waits for the generation of the data file before it copies it back to host machine.
In addition, the IDE generates notes files (.gcno) when it compiles projects that have enabled code coverage.
There are multiple ways to import a file.
It isn't necessary to move the file you want to import into the Workspace location.
By default, the .gcda files for gcc are located in a folder structure created under /tmp.
When copying a project_name.gcda file into your workspace, you must copy it to the top level of the directory structure. In this case, it is the variant_name/o_g directory.
- Create and build a project with code coverage selected. For information about enabling code coverage, see Enable code coverage earlier in this chapter.
- Create a launch configuration where code coverage is disabled.
- Run this configuration.
- SelectNext. and click
Specify the name of the session, project, and platform used to generate the code coverage data. Click Next.
Now, you'll browse on the remote target to the folder that contains the data file.
- Optional: If you want to browse the remote file system for the Coverage protocol type (i.e. .gdca), browse to the location where the data files are located (such as on the remote target, within the workspace, or on the filesystem).
- Optional: If there are referenced projects to include data for, select the referenced projects to import code coverage data from. Also specify a comment about the import session, if desired.
- Optional: To select protocol type and coverage data location, click Next, deselect the Look up in the project option, and then select one of Remote target, Workspace or File System to browse for the coverage data location.
Now, the Code Coverage tab shows the session name and imported gcc code coverage data for the selected project.
- Optional: Observe the target's directory using the Target File System Navigator tab in the Tasks view (bottom of the Workbench window) in the location where the file
By default, you won't have the Target File System Navigator tab in your Tasks view. To add this tab to your view:
- Select .
- Expand QNX Targets.
- Select Target File System Navigator.
- Click OK.
For a QNX project, if a project is built using gcc version 4.6, the files are created under the variant_name/o_g directory.
- Optional: For the target, right-click on the file project_name.gcda and select .
- Optional: In the Select Target Folder window, specify a folder location to copy the file, and click OK.
The project_name.gcda will be visible under the C/C++ tab for the corresponding project.
Last modified: 2013-12-21