From db00af180fb2a68bbbf5dc44849f0aeeba296471 Mon Sep 17 00:00:00 2001 From: "Christian Holler (:decoder)" Date: Tue, 28 Nov 2023 11:16:08 +0000 Subject: [PATCH] Bug 1866421 - Make Nyx::is_replay work before snapshot point. r=truber Differential Revision: https://phabricator.services.mozilla.com/D194643 --- tools/fuzzing/ipc/IPCFuzzController.cpp | 4 ++++ tools/fuzzing/nyx/Nyx.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/fuzzing/ipc/IPCFuzzController.cpp b/tools/fuzzing/ipc/IPCFuzzController.cpp index e3e7c30654da..06f2fc3b3789 100644 --- a/tools/fuzzing/ipc/IPCFuzzController.cpp +++ b/tools/fuzzing/ipc/IPCFuzzController.cpp @@ -1088,6 +1088,10 @@ void IPCFuzzController::SynchronizeOnMessageExecution( static void dumpIPCMessageToFile(const UniquePtr& aMsg, uint32_t aDumpCount, bool aUseNyx = false) { + if (Nyx::instance().is_replay()) { + return; + } + std::stringstream dumpFilename; std::string msgName(IPC::StringFromIPCMessageType(aMsg->type())); std::replace(msgName.begin(), msgName.end(), ':', '_'); diff --git a/tools/fuzzing/nyx/Nyx.cpp b/tools/fuzzing/nyx/Nyx.cpp index 5ef48301e00b..3fbb520b11eb 100644 --- a/tools/fuzzing/nyx/Nyx.cpp +++ b/tools/fuzzing/nyx/Nyx.cpp @@ -19,7 +19,12 @@ namespace mozilla { namespace fuzzing { -Nyx::Nyx() {} +Nyx::Nyx() { + char* testFilePtr = getenv("MOZ_FUZZ_TESTFILE"); + if (testFilePtr) { + mReplayMode = true; + } +} // static Nyx& Nyx::instance() { @@ -63,8 +68,6 @@ void Nyx::start(void) { // Check if we are in replay mode. char* testFilePtr = getenv("MOZ_FUZZ_TESTFILE"); if (testFilePtr) { - mReplayMode = true; - MOZ_FUZZING_NYX_PRINT("[Replay Mode] Reading data file...\n"); std::string testFile(testFilePtr);