Skip to content

Commit

Permalink
TraceCollection: fix trace index mismatch
Browse files Browse the repository at this point in the history
when inserting a new trace it must be appended to
the end of the list so that the indexes are kept consistent

i.e. the index of the new trace in the new list is
the length of the old list
  • Loading branch information
danmatichuk committed Nov 19, 2024
1 parent 43ae7c6 commit 0940494
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Pate/TraceCollection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ insertReg ::
TraceCollection sym arch ->
TraceCollection sym arch
insertReg reg tr trcol = trcol
{ trAllTraces = tr:(trAllTraces trcol)
{ trAllTraces = (trAllTraces trcol) ++ [tr]
, trTraceMapRegs = Map.insertWith Set.union (Some reg) (Set.singleton (length (trAllTraces trcol))) (trTraceMapRegs trcol)
}

Expand All @@ -99,7 +99,7 @@ insertCell ::
TraceCollection sym arch ->
TraceCollection sym arch
insertCell cell tr trcol = trcol
{ trAllTraces = tr:(trAllTraces trcol)
{ trAllTraces = (trAllTraces trcol) ++ [tr]
, trTraceMapCells = Map.insertWith Set.union (Some cell) (Set.singleton (length (trAllTraces trcol))) (trTraceMapCells trcol)
}

Expand Down Expand Up @@ -137,7 +137,7 @@ insert ::
TraceCollection sym arch ->
TraceCollection sym arch
insert regs cells tr trcol = trcol
{ trAllTraces = tr:(trAllTraces trcol)
{ trAllTraces = (trAllTraces trcol) ++ [tr]
, trTraceMapRegs =
foldr (\reg -> Map.insertWith Set.union reg (Set.singleton idx)) (trTraceMapRegs trcol) regs
, trTraceMapCells =
Expand Down

0 comments on commit 0940494

Please sign in to comment.