From f56b4dcc82d7af38bf94d643c5750cf49a91a297 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 19 Nov 2024 16:42:32 +0100 Subject: pkg/manager: show number of times coverage for each call has overflowed If the overflows happen often, it's bad. Add visibility into this. --- executor/executor.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'executor/executor.cc') diff --git a/executor/executor.cc b/executor/executor.cc index 5b5e06422..603f23f73 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -362,6 +362,8 @@ struct cover_t { // offset (VM_MIN_KERNEL_ADDRESS for AMD64) and then truncates the result to // uint32_t. We get this from the 'offset' member in ksancov_trace. intptr_t pc_offset; + // The coverage buffer has overflowed and we have truncated coverage. + bool overflow; }; struct thread_t { @@ -1177,6 +1179,7 @@ uint32 write_comparisons(flatbuffers::FlatBufferBuilder& fbb, cover_t* cov) kcov_comparison_t* cov_start = (kcov_comparison_t*)(cov->data + sizeof(uint64)); if ((char*)(cov_start + ncomps) > cov->data_end) failmsg("too many comparisons", "ncomps=%llu", ncomps); + cov->overflow = ((char*)(cov_start + ncomps + 1) > cov->data_end); rpc::ComparisonRaw* start = (rpc::ComparisonRaw*)cov_start; rpc::ComparisonRaw* end = start; // We will convert kcov_comparison_t to ComparisonRaw inplace. @@ -1295,6 +1298,8 @@ void write_output(int index, cover_t* cov, rpc::CallFlag flags, uint32 error, bo } rpc::CallInfoRawBuilder builder(*output_builder); + if (cov->overflow) + flags |= rpc::CallFlag::CoverageOverflow; builder.add_flags(flags); builder.add_error(error); if (signal_off) -- cgit mrf-deployment