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 IDE 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.

Note:

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.

To import gcc code coverage data from a project:
  1. Create and build a project with code coverage selected. For information about enabling code coverage, see Enable code coverage earlier in this chapter.
  2. Create a launch configuration where code coverage is disabled.
  3. Run this configuration.
  4. SelectFile > Import > QNX > GCC Coverage Data and click Next.
  5. 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.
  6. 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).
  7. 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.
  8. 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.
  9. Click Finish. Now, the Code Coverage tab shows the session name and imported gcc code coverage data for the selected project.
After you run the configuration in Step 3, you can choose to do the following:
  1. 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 project_name.gcda resides.

    By default, you won't have the Target File System Navigator tab in your Tasks view. To add this tab to your view:

    1. Select Window > Show View > Other.
    2. Expand QNX Targets.
    3. Select Target File System Navigator.
    4. Click OK.
    Note:

    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.

  2. Optional: For the target, right-click on the file project_name.gcda and select Copy to > Workspace.
  3. 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.