Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

Code Coverage data missing
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: Code coverage
  • SDP: 7.1.0
  • Target: AArch64, x86_64
________________________________________________________________________

Issue
________________________________________________________________________
    If you have multiple source files, building the project with just one qcc call ends up with Code Coverage data of just one file, i.e. just one gcno and gcda file is created, which can result in missing code coverage data.

    # qcc -Vgcc_ntox86_64 -ftest-coverage -fprofile-arcs file1.c file2.c file3.c -o project


    ________________________________________________________________________

    Solution
    ________________________________________________________________________
      If Code Coverage data doesn't appear in the IDE or with gcov. Make sure you have compiled any c-file with qcc instead of one qcc command with all c-files as arguments

      For example:

      You project has 3 c-files: file1.c, file2.c and file3.c. Building the project with these steps results in working code coverage:

      # qcc -Vgcc_ntox86_64 -c -ftest-coverage -fprofile-arcs file1.c -o file1.o
      # qcc -Vgcc_ntox86_64 -c -ftest-coverage -fprofile-arcs file2.c -o file2.o
      # qcc -Vgcc_ntox86_64 -c -ftest-coverage -fprofile-arcs file3.c -o file3.o
      # qcc -Vgcc_ntox86_64 -ftest-coverage -fprofile-arcs file1.o file2.o file3.o -o project

      This will create 3 header files during build time on the host machine:

      file1.gcno file2.gcno file3.gcno

      Running the program on the target creates (set GCOV_PREFIX_STRIP and GCOV_PREFIX):

      file1.gcda file2.gcda file3.gcda

      You should see Code Coverage results in the IDE or with gcov-dump from command line.


      ________________________________________________________________________
      NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
      ________________________________________________________________________


      Related Attachments
       None Found





      Please contact us with your questions or concerns.