Skip to content

Commit

Permalink
Bug 1866421 - Make Nyx::is_replay work before snapshot point. r=truber
Browse files Browse the repository at this point in the history
  • Loading branch information
choller committed Nov 27, 2023
1 parent 76269b7 commit 993863a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tools/fuzzing/ipc/IPCFuzzController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,10 @@ void IPCFuzzController::SynchronizeOnMessageExecution(

static void dumpIPCMessageToFile(const UniquePtr<IPC::Message>& 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(), ':', '_');
Expand Down
9 changes: 6 additions & 3 deletions tools/fuzzing/nyx/Nyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 993863a

Please sign in to comment.