From 4e364131813c5977f3212f6edf6bbd1a3bd1e84a Mon Sep 17 00:00:00 2001 From: FuzzTest Team Date: Mon, 2 Dec 2024 00:45:05 -0800 Subject: [PATCH] Print mutator log when runner log requested. In developing fuzzers, it's often useful to print logging from the fuzzer binary, and centipede provided a command-line argument to do that. However this argument didn't apply to invocations for the purpose of gathering mutants, thus it was hard to debug problems when developing custom implementations of LLVMFuzzerCustomMutator and similar. Add logging in this case too. PiperOrigin-RevId: 701867237 --- centipede/centipede_callbacks.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/centipede/centipede_callbacks.cc b/centipede/centipede_callbacks.cc index 3ef72e60..f31cfc30 100644 --- a/centipede/centipede_callbacks.cc +++ b/centipede/centipede_callbacks.cc @@ -307,6 +307,8 @@ bool CentipedeCallbacks::MutateViaExternalBinary( if (retval != EXIT_SUCCESS) { LOG(WARNING) << "Custom mutator failed with exit code " << retval; + } + if (env_.print_runner_log || retval != EXIT_SUCCESS) { PrintExecutionLog(); } @@ -320,6 +322,7 @@ bool CentipedeCallbacks::MutateViaExternalBinary( mutants[i].assign(blob.data, blob.data + blob.size); } outputs_blobseq_.ReleaseSharedMemory(); // Outputs are already consumed. + VLOG(1) << __FUNCTION__ << " took " << (absl::Now() - start_time); return retval == 0; }