From 0940494f51b6e2e70a1c30ddc736f80bf873ef44 Mon Sep 17 00:00:00 2001 From: Daniel Matichuk Date: Tue, 19 Nov 2024 15:30:24 -0800 Subject: [PATCH] TraceCollection: fix trace index mismatch 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 --- src/Pate/TraceCollection.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pate/TraceCollection.hs b/src/Pate/TraceCollection.hs index 96511463..5916da37 100644 --- a/src/Pate/TraceCollection.hs +++ b/src/Pate/TraceCollection.hs @@ -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) } @@ -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) } @@ -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 =