An option for data collection

Option

Default

-follow-child-processes

no

This option controls whether PureCoverage monitors child processes created when an instrumented program forks.

If this option is not specified, PureCoverage does not accumulate counts for child processes, and does not write counts data for the child process to the  .pcv file.

If this option is set to yes, PureCoverage accumulates coverage data for the child process. When the child process exits or executes another process, PureCoverage writes the accumulated counts in the child to the .pcv file.

Likewise, when the parent process exits, PureCoverage writes counts accumulated in the parent to the .pcv file. By default, PureCoverage writes both parent and child counts to the same .pcv file ( %v.pcv ), so that viewing that file shows the combined coverage data.

To separate the counts for parent and child, you can use the option -counts-file = %v.%p.pcv to specify a counts file including the process pid in the filename, or call the API function purecov_set_filename() in either or both the parent or child process to control where the data is written.