Compilation prerequisites

General rules

If the traces are intended to be used for source coverage analysis, regardless of the actual criteria to be assessed afterwards, sources must be compiled with -g -fpreserve-control-flow -fdump-scos to control optimizations and allow mapping trace info to source constructs. -gno-strict-dwarf is required in addition for VxWorks targets, together with -mlongcall for PowerPC configurations.

Optimization is supported up to -O1, with inlining allowed. However, if the binary version of the code under test during the coverage campaign is intended to be used directly in operational conditions, care is needed to prevent inlining of the code under test within the testing code at compilation time in unit-testing campaigns. With GCC based toolchains such as GNAT Pro, this can be achieved by adding -fno-inline to the compilation options of the testing code.

The -fprofile-arcs or --coverage compilation switches, intended for analysis with the gcov tool, are incompatible with the needs of GNATcoverage for binary traces and must not be used. Likewise for the -gnatV family of GNAT Pro switches requesting data validity checks other than those mandated by the Ada RM (special case of -gnatVd).

For object coverage assessments, only -g is of possible use, if you intend to produce annotated sources as coverage reports. If source coverage analysis is to be performed as well, and you have no particular constraint on the form of the machine code for which object coverage is needed, the whole process might turn simpler if the same compilation options are used for both kinds of analysis. There is no incompatibility with object coverage analysis incurred by compiling the code compiled with options required for source coverage.