As a child process uses the execvp() call, an explicit dumping of the collected profile information is required.
Coverage:
on the master branch:
with this PR:
This PR mostly follows gcc/libgcc/libgcov-interface.c#L320-L332:
/* A wrapper for the execvp function. Flushes the accumulated
profiling data, so that they are not lost. */
int
__gcov_execvp (const char *path, char *const argv[])
{
/* Dump counters only, they will be lost after exec. */
__gcov_dump ();
int ret = execvp (path, argv);
/* We reach this code only when execv fails, reset counter then here. */
__gcov_reset ();
return ret;
}