Covering multiple processes(Purify/Purecov)

You can cover multiple processes using fork,  exec , or  vfork .

Using fork

By default, PureCoverage does not accumulate coverage data for child processes, since a common reason for forking is to execute a new process right away.

You can specify the  -follow-child-processes   option if you want PureCoverage to accumulate coverage data for the child process. When this option is set and 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 for the parent to the . pcv   file.

By default, when this option is set, PureCoverage combines coverage data for both the parent and child in the same  .pcv   file.

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.

Using exec

When an instrumented program calls  exec   or related functions with a valid executable filename specified in the path argument, PureCoverage accumulates the coverage data in the  .pcv   file for the calling process before the exec is attempted. The counts are then set to zero. If the  exec   fails, and the calling process continues to run, the counts are correctly updated when the process finally exits or does a successful  exec .

If the  exec   is done from a child process and you have not set the  -follow-child-processes   option, no coverage data is accumulated, and no data is written at the time of the  exec .

The process invoked by  exec   is a new process, and does not share coverage information or status with the calling process. If the invoked process is itself a PureCoverage instrumented program, it starts accumulating coverage data regardless of whether the program calling  exec   was instrumented, and whether you set the  -follow-child-processes  option.

Using vfork

A child process started with  vfork   shares a common address and accumulated coverage data with its parent. PureCoverage counting is not disabled in the child process of a  vfork , even if you set the option  -follow-child-processes=no .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值