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_linux.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'executor/executor_linux.h') diff --git a/executor/executor_linux.h b/executor/executor_linux.h index 82a1d559a..f2e9d4df6 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -180,14 +180,22 @@ static void cover_reset(cover_t* cov) cover_unprotect(cov); *(uint64*)cov->data = 0; cover_protect(cov); + cov->overflow = false; +} + +template +static void cover_collect_impl(cover_t* cov) +{ + cov->size = *(cover_data_t*)cov->data; + cov->overflow = (cov->data + (cov->size + 2) * sizeof(cover_data_t)) > cov->data_end; } static void cover_collect(cover_t* cov) { if (is_kernel_64_bit) - cov->size = *(uint64*)cov->data; + cover_collect_impl(cov); else - cov->size = *(uint32*)cov->data; + cover_collect_impl(cov); } // One does not simply exit. -- cgit mrf-deployment