Create a launch configuration to start a coverage-enabled program

To start a program and measure the code coverage:
  1. Create a C/C++ QNX IP launch configuration as you normally would, but don't click OK yet.
  2. On the launcher, click the Tools tab.
  3. Click Add/Delete Tool. The Tools selection dialog appears.
  4. Select the Code Coverage tool.
    When you build an application with the Build with Code Coverage build option enabled (set for the project earlier) and then later launch it using a C/C++ QNX Qconn (IP) launch configuration, the instrumented code linked into the process connects to qconn, allowing the coverage data to be read from the process's data space. However, if you launch a coverage-built process with coverage disabled in the launch configuration, this causes the process to write the coverage information to a data file (.gcda) at run time, rather than read it from the process's data space. Later, you can import the data into the code coverage tool. For information about importing and interpreting data from a project, see Import gcc code coverage data from a project.

  5. Click OK.
  6. Click the Code Coverage tab, and fill in any required fields:

    Code Coverage data format
    Select gcc 4.3 or later to enable code coverage metrics collection if your application was compiled with gcc 4.3 or later.
    Comments for this Code Coverage session
    Your notes about the session, for your own personal use. The comments appear at the top of the generated reports.
    Code Coverage data scan interval (sec)
    Sets how often the Code Coverage tool polls for data. A low setting can cause continuous network traffic. The default setting of 5 seconds should be sufficient.
    Collect data for
    By default, all code coverage data built with code coverage in a project is included in the current Code Coverage session. To include referenced projects or to only collect data from certain sources, disable the option All Sources in this application compiled with code coverage, and then click Select to select the projects or files that you want to collect code coverage data for.
    Select
    Opens the Projects to include Code Coverage data from dialog so you can choose projects to include your coverage data (projects and files). Select any project from this list that you wish to gather code coverage data for. Note that projects must be built with code coverage enabled to capture data.

  7. Optional: Click Advanced to define a signal to enable the dynamic collection of code coverage data. The IDE will send a signal to suspend the application thread so that it can perform data collection.

  8. Check Switch to this tool's perspective on launch if you want to automatically go to the QNX Code Coverage perspective when you run or debug.
  9. Click Apply.
  10. Click Run or Debug.
In the IDE, the QNX Code Coverage perspective shows the code coverage information for the project you specified: