Skip to content

Commit

Permalink
Fix rewinding would undo one too many events.
Browse files Browse the repository at this point in the history
Fix from Matt Breindel.
  • Loading branch information
deplinenoise committed Jun 21, 2015
1 parent da35f06 commit 056e27d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tool/MemTrace/TraceReplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,19 @@ protected bool PrevEvent(double? minTime)

bool isV3 = MetaData.Version >= 3;

EventHeader headerSkip;
EventHeader.Decode(out headerSkip, v, ref pos);

pos = m_MmapPos - headerSkip.BackLink;
var resetPos = pos;
EventHeader header;
EventHeader.Decode(out header, v, ref pos);

if (minTime.HasValue && minTime > header.TimeStamp)
return false;

{
m_MmapPos = inpos;
return false;
}
m_CurrentTime = header.TimeStamp;

switch (header.Code)
Expand Down Expand Up @@ -769,7 +776,7 @@ protected bool PrevEvent(double? minTime)
throw new IOException(String.Format("Unexpected event code {0} in stream at position {1}", header.Code, m_MmapPos));
}

m_MmapPos = inpos - header.BackLink;
m_MmapPos = resetPos;
return true;
}

Expand Down

0 comments on commit 056e27d

Please sign in to comment.