From f815599d9539b0606408a912fe53e2e80bbc4629 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Wed, 12 Jun 2024 11:06:56 +0200 Subject: executor: fix extraction of number of KCOV comparisons from coverage data KCOV stores the number of KCOV comparisons in a coverage buffer always as a 64-bit integer at offset 0 of the coverage buffer. Don't use the field size of the coverage object which is initialized in cover_collect() and size of which depends on kernel bitness because this field is intended only for KCOV PC coverage and not for KCOV comparisons. Signed-off-by: Alexander Egorenkov --- executor/executor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'executor') diff --git a/executor/executor.cc b/executor/executor.cc index c2c361ccf..0d08f562b 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -1117,11 +1117,11 @@ void write_call_output(thread_t* th, bool finished) if (flag_comparisons) { // Collect only the comparisons - uint32 ncomps = th->cov.size; + uint64 ncomps = *(uint64_t*)th->cov.data; kcov_comparison_t* start = (kcov_comparison_t*)(th->cov.data + sizeof(uint64)); kcov_comparison_t* end = start + ncomps; if ((char*)end > th->cov.data_end) - failmsg("too many comparisons", "ncomps=%u", ncomps); + failmsg("too many comparisons", "ncomps=%llu", ncomps); cover_unprotect(&th->cov); std::sort(start, end); ncomps = std::unique(start, end) - start; @@ -1141,7 +1141,7 @@ void write_call_output(thread_t* th, bool finished) else write_coverage_signal(&th->cov, signal_count_pos, cover_count_pos); } - debug_verbose("out #%u: index=%u num=%u errno=%d finished=%d blocked=%d sig=%u cover=%u comps=%u\n", + debug_verbose("out #%u: index=%u num=%u errno=%d finished=%d blocked=%d sig=%u cover=%u comps=%llu\n", completed, th->call_index, th->call_num, reserrno, finished, blocked, *signal_count_pos, *cover_count_pos, *comps_count_pos); completed++; -- cgit mrf-deployment