An option for merging data

Option

Default

-force-merge

no

This option controls how PureCoverage handles data that it collects from different versions of a program.

By default, PureCoverage discards or merges the data from a previous version based on object files. For object files that have changed, PureCoverage discards any data it has previously collected. For unchanged object files, PureCoverage merges previously collected data into the PureCoverage data file. PureCoverage uses an object code checksum to detect whether an object file has changed.

Use the -force-merge option to merge all coverage data from different versions of a program even when object files have changed.

Warning: If you make changes that affect source code line numbers, the -force-merge option produces garbled results for line coverage because PureCoverage cannot assign the data to the correct lines. Function coverage data, however, continues to be reliable in these cases.

You can use the option at run time, or with the -merge and -view mode options.

Example

This example shows how to merge data collected from two versions of a program that are generated by conditional compilation:

#ifdef VERSION1
do_something();
#else
do_something_else();
#endif

Compile and run each version of the program, then use the -force-merge option with the -view mode option to combine and display the coverage data for the two versions:

% purecov cc -g -DVERSION1 myprog.c -o myprog1
%
purecov cc -g -DVERSION2 myprog.c -o myprog2
% myprog1
% myprog2
% purecov -view -force-merge myprog1.pcv myprog2.pcv