Bug 1470795 Part 10 - Include progress counter in record/replay assertion streams, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Sun, 22 Jul 2018 12:00:14 +0000
changeset 469499 a4a06f53d689f3dedfca8eaf23f417ec54696927
parent 469498 dd58259f140ade2a5f38b41978c5e8f0bdb4ca28
child 469500 22d28e5778fd7b1c0e7aaf1752fc773111ab39aa
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs1470795
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1470795 Part 10 - Include progress counter in record/replay assertion streams, r=froydnj.
toolkit/recordreplay/ProcessRecordReplay.cpp
--- a/toolkit/recordreplay/ProcessRecordReplay.cpp
+++ b/toolkit/recordreplay/ProcessRecordReplay.cpp
@@ -416,28 +416,38 @@ RecordReplayInterface_InternalRecordRepl
     AutoPassThroughThreadEvents pt;
     SetCurrentStackString(text, text + strlen(text), sizeof(text) - strlen(text));
   }
 
   size_t textLen = strlen(text);
 
   if (IsRecording()) {
     thread->Asserts().WriteScalar(thread->Events().StreamPosition());
+    if (thread->IsMainThread()) {
+      thread->Asserts().WriteScalar(*ExecutionProgressCounter());
+    }
     thread->Asserts().WriteScalar((textLen << 1) | AssertionBit);
     thread->Asserts().WriteBytes(text, textLen);
   } else {
     // While replaying, both the assertion's name and the current position in
     // the thread's events need to match up with what was recorded. The stack
     // portion of the assertion text does not need to match, it is used to help
     // track down the reason for the mismatch.
     bool match = true;
     size_t streamPos = thread->Asserts().ReadScalar();
     if (streamPos != thread->Events().StreamPosition()) {
       match = false;
     }
+    size_t progress = 0;
+    if (thread->IsMainThread()) {
+      progress = thread->Asserts().ReadScalar();
+      if (progress != *ExecutionProgressCounter()) {
+        match = false;
+      }
+    }
     size_t assertLen = thread->Asserts().ReadScalar() >> 1;
 
     char* buffer = thread->TakeBuffer(assertLen + 1);
 
     thread->Asserts().ReadBytes(buffer, assertLen);
     buffer[assertLen] = 0;
 
     if (assertLen < textLen || memcmp(buffer, text, textLen) != 0) {
@@ -454,20 +464,21 @@ RecordReplayInterface_InternalRecordRepl
       }
 
       {
         AutoPassThroughThreadEvents pt;
         SetCurrentStackString(text, text + strlen(text), sizeof(text) - strlen(text));
       }
 
       child::ReportFatalError("Assertion Mismatch: Thread %d\n"
-                              "Recorded: %s [%d]\n"
-                              "Replayed: %s [%d]\n",
-                              (int) thread->Id(), buffer, (int) streamPos, text,
-                              (int) thread->Events().StreamPosition());
+                              "Recorded: %s [%d,%d]\n"
+                              "Replayed: %s [%d,%d]\n",
+                              (int) thread->Id(), buffer, (int) streamPos, (int) progress, text,
+                              (int) thread->Events().StreamPosition(),
+                              (int) (thread->IsMainThread() ? *ExecutionProgressCounter() : 0));
       Unreachable();
     }
 
     thread->RestoreBuffer(buffer);
 
     // Push this assert onto the recent assertions in the thread.
     free(thread->RecentAssert(Thread::NumRecentAsserts - 1).mText);
     for (size_t i = Thread::NumRecentAsserts - 1; i >= 1; i--) {