@@ -135,28 +135,22 @@ public synchronized static Value pickSuccessor(final Tool tool, final ExprOrOpAr
135135 }
136136 }
137137
138- @ TLAPlusOperator (identifier = "Trace" , module = "TLCExt" , minLevel = 1 , warn = false )
139- public synchronized static Value getTrace () throws IOException {
138+ @ Evaluation (definition = "Trace" , module = "TLCExt" , minLevel = 1 , warn = false )
139+ public synchronized static Value getTrace (final Tool tool , final ExprOrOpArgNode [] args , final Context c ,
140+ final TLCState s0 , final TLCState s1 , final int control , final CostModel cm ) throws IOException {
140141 final ModelChecker mc = (ModelChecker ) TLCGlobals .mainChecker ;
141142 final ConcurrentTLCTrace traceFile = mc .trace ;
142143
143- // If Trace operator is evaluated during the next-state relation, it will return
144- // the state from which the next state is generated.
145- final TLCState currentState = IdThread .getCurrentState ();
146- if (currentState == null ) {
147- return new TupleValue (new Value [0 ]);
144+ if (s0 .isInitial ()) {
145+ return new TupleValue (new Value [] { new RecordValue (s0 ) });
148146 }
149147
150- if (currentState .isInitial ()) {
151- return new TupleValue (new Value [] { new RecordValue (currentState ) });
152- }
153-
154- final TLCStateInfo [] trace = traceFile .getTrace (currentState );
148+ final TLCStateInfo [] trace = traceFile .getTrace (s0 );
155149 final Value [] values = new Value [trace .length + 1 ];
156150 for (int j = 0 ; j < (trace .length ); j ++) {
157151 values [j ] = new RecordValue (trace [j ].state );
158152 }
159- values [values .length - 1 ] = new RecordValue (currentState );
153+ values [values .length - 1 ] = new RecordValue (s0 );
160154 return new TupleValue (values );
161155 }
162156}
0 commit comments