wiki:GSoC/2011/gcov

Version 6 (modified by Chris Johns, on Dec 2, 2014 at 9:57:24 AM) (diff)

--

RTEMSgcov

Mentors: Joel Sherrill

Volunteer: Pawe? Zagórski

Status: Functionality is being moved to produciton envirnment

Introduction: gcov is a tool for analysing the coverage of an application. It can also provide some profiling information.

We would like to see the RTEMS Coverage Analysis tool covoar augmented to generate gcof format output. This would allow the RTEMS Development Team to use different tools to analyse the results of the current coverage testing runs. These tools include gcov, lconv, and zcov

Goal: To design and develop support for gcov for RTEMS.

Requirements: C++

Resources: See the References section below.

Acknowledgements

  • who helped add did work

Toolset architecture

Primary work on gcov support for RTEMS tests is now done. Architecture is as follows:

  • we are using standard gcov tool that comes along with gcc
  • gcov tool uses two input files to generate *.gcov report for each source code file. Input file *.gcno contains information about program structure and is usually generated by gcc on compilation when -ftest-coverage flag is used. The *.gcda file contains instruction coverage count values created by tested program on execution when it was compiled with flag -fprofile-arcs.
  • we are providing gcov with *.gcno files in a standard fashion by compiling RTEMS with -ftest-coverage flag
  • we are not using -fprofile-arcs to generate execution count files. The main reason is that this adds instrumentation to code making it different from the end product. Instead we are using covoar tool to gather execution count data from quemu traces. Covoar module responsible from generating *.gcda files also needs *.gcno files generated by gcc to correctly format the execution counts

Usage Instructions

1) Make sure gcov command is available.

2) Run coverage tests by issuing do_coverage with additional -g flag, for example:

./do_coverage -c -b -r -R -t -f -g -C -B qemuppc

3) Examine outputs in ${BASEDIR}/b-${BSP} . In each sub-directory containing object files you should find:

  • one *.gcno file ber object generated by gcc
  • one *.gcda file per object generated by covoar tool
  • one *.txt file per object generated by covoar tool. It contains structure of a source file in human-readable format
  • one *.c.gcov report generated by regular gcov tool from *.gcno and *.gcda
  • one gcov.log per sub-directory containing logs.

Limitations

  • Skyeye and Tsim are not currently supported. This is due to incomplete information in execution traces generated by those tools and it will not be supported in the near future.
  • Problems occur when -ftest-coverage flag is used along with -o2 or -os gcc flag. Gcov tool is known to have issues with code optimization. This configuration is currently not supported. Possible fixes of the problem are being looked into.
  • Some tests fail when generation of gcov reports is enabled. The reason seems to lie in added -ftest-coverage and removed -Os flag while compilation RTEMS. This issue is under investigation.
  • Due to possible problem in couverture quemu gcov reports generated do not seem to contain correct data right now. Execution traces generated by qemu are not consistent. Gcov reports seem to correspond to the traces used as input, but they don't make sense in terms of logical program flow. This problem is being worked on.

References

Other sections: If you have more to say about the project that doesn't fit in the proposed sections of this template, feel free to add other sections at will.