Bug 1866421 - Make Nyx::is_replay work before snapshot point. r=truber

Differential Revision: https://phabricator.services.mozilla.com/D194643
This commit is contained in:
Christian Holler (:decoder) 2023-11-28 11:16:08 +00:00
parent 01f1337180
commit 7504f01021
2 changed files with 10 additions and 3 deletions

View File

@ -1088,6 +1088,10 @@ void IPCFuzzController::SynchronizeOnMessageExecution(
static void dumpIPCMessageToFile(const UniquePtr<IPC::Message>& aMsg, static void dumpIPCMessageToFile(const UniquePtr<IPC::Message>& aMsg,
uint32_t aDumpCount, bool aUseNyx = false) { uint32_t aDumpCount, bool aUseNyx = false) {
if (Nyx::instance().is_replay()) {
return;
}
std::stringstream dumpFilename; std::stringstream dumpFilename;
std::string msgName(IPC::StringFromIPCMessageType(aMsg->type())); std::string msgName(IPC::StringFromIPCMessageType(aMsg->type()));
std::replace(msgName.begin(), msgName.end(), ':', '_'); std::replace(msgName.begin(), msgName.end(), ':', '_');

View File

@ -19,7 +19,12 @@
namespace mozilla { namespace mozilla {
namespace fuzzing { namespace fuzzing {
Nyx::Nyx() {} Nyx::Nyx() {
char* testFilePtr = getenv("MOZ_FUZZ_TESTFILE");
if (testFilePtr) {
mReplayMode = true;
}
}
// static // static
Nyx& Nyx::instance() { Nyx& Nyx::instance() {
@ -63,8 +68,6 @@ void Nyx::start(void) {
// Check if we are in replay mode. // Check if we are in replay mode.
char* testFilePtr = getenv("MOZ_FUZZ_TESTFILE"); char* testFilePtr = getenv("MOZ_FUZZ_TESTFILE");
if (testFilePtr) { if (testFilePtr) {
mReplayMode = true;
MOZ_FUZZING_NYX_PRINT("[Replay Mode] Reading data file...\n"); MOZ_FUZZING_NYX_PRINT("[Replay Mode] Reading data file...\n");
std::string testFile(testFilePtr); std::string testFile(testFilePtr);