From d09987bf4245ee5e985530f65901855f39f273a3 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 6 Aug 2024 08:49:09 +0200 Subject: executor: fix coverage collection in snapshot mode Fixes #5143 --- executor/executor.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'executor') diff --git a/executor/executor.cc b/executor/executor.cc index b550fc0cf..35fa27c47 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -1372,11 +1372,13 @@ void* worker_thread(void* arg) { thread_t* th = (thread_t*)arg; current_thread = th; - if (cover_collection_required()) - cover_enable(&th->cov, flag_comparisons, false); - for (;;) { + for (bool first = true;; first = false) { event_wait(&th->ready); event_reset(&th->ready); + // Setup coverage only after receiving the first ready event + // because in snapshot mode we don't know coverage mode for precreated threads. + if (first && cover_collection_required()) + cover_enable(&th->cov, flag_comparisons, false); execute_call(th); event_set(&th->done); } -- cgit mrf-deployment