Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: use different remote kcov handles each time #4893

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions executor/executor_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,16 @@ static void cover_enable(cover_t* cov, bool collect_comps, bool extra)
.area_size = kExtraCoverSize,
.num_handles = 1,
};
arg.common_handle = kcov_remote_handle(KCOV_SUBSYSTEM_COMMON, procid + 1);
arg.handles[0] = kcov_remote_handle(KCOV_SUBSYSTEM_USB, procid + 1);

// Let's use a different kcov remote handle each restart -- we don't want to
// see the remote coverage triggered by the already exited executors.
struct timeval curr_time;
gettimeofday(&curr_time, NULL);
uint64 current_usec = curr_time.tv_sec * 1000000 + curr_time.tv_usec;
// Combine procid with the current time.
uint64 instance_id = (current_usec & KCOV_INSTANCE_MASK & ~0xF) | (procid & 0xF);
arg.common_handle = kcov_remote_handle(KCOV_SUBSYSTEM_COMMON, instance_id);
arg.handles[0] = kcov_remote_handle(KCOV_SUBSYSTEM_USB, instance_id);
if (ioctl(cov->fd, KCOV_REMOTE_ENABLE, &arg))
exitf("remote cover enable write trace failed");
}
Expand Down
Loading