File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
regression/cbmc/trace_options_json_extended Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 4
4
^EXIT=10$
5
5
^SIGNAL=0$
6
6
rawLhs
7
+ "ssaLhs": "main::argc!0@1#1",
8
+ "ssaRhs": "argc'#0",
7
9
--
Original file line number Diff line number Diff line change @@ -118,6 +118,9 @@ class goto_trace_stept
118
118
bool cond_value;
119
119
exprt cond_expr;
120
120
121
+ // for assignments
122
+ exprt lhs, rhs;
123
+
121
124
// for assert
122
125
irep_idt property_id;
123
126
std::string comment;
@@ -161,6 +164,8 @@ class goto_trace_stept
161
164
full_lhs.make_nil ();
162
165
full_lhs_value.make_nil ();
163
166
cond_expr.make_nil ();
167
+ lhs.make_nil ();
168
+ rhs.make_nil ();
164
169
}
165
170
};
166
171
Original file line number Diff line number Diff line change @@ -14,8 +14,10 @@ Author: Daniel Kroening
14
14
#include " json_goto_trace.h"
15
15
16
16
#include < langapi/language_util.h>
17
+
17
18
#include < util/arith_tools.h>
18
19
#include < util/config.h>
20
+ #include < util/format_expr.h>
19
21
#include < util/invariant.h>
20
22
#include < util/simplify_expr.h>
21
23
@@ -154,6 +156,19 @@ void convert_decl(
154
156
step.assignment_type == goto_trace_stept::assignment_typet::ACTUAL_PARAMETER
155
157
? " actual-parameter"
156
158
: " variable" );
159
+
160
+ if (trace_options.json_full_lhs )
161
+ {
162
+ std::ostringstream oss;
163
+ oss << format (step.lhs );
164
+ json_assignment[" ssaLhs" ] = json_stringt (oss.str ());
165
+ }
166
+ if (trace_options.json_full_lhs && step.rhs .is_not_nil ())
167
+ {
168
+ std::ostringstream oss;
169
+ oss << format (step.rhs );
170
+ json_assignment[" ssaRhs" ] = json_stringt (oss.str ());
171
+ }
157
172
}
158
173
159
174
// / Convert an OUTPUT goto_trace step.
Original file line number Diff line number Diff line change @@ -407,6 +407,15 @@ void build_goto_trace(
407
407
goto_trace_step.cond_value =
408
408
decision_procedure.get (SSA_step.cond_handle ).is_true ();
409
409
}
410
+ else if (SSA_step.is_assignment ())
411
+ {
412
+ goto_trace_step.lhs = SSA_step.ssa_lhs ;
413
+ goto_trace_step.rhs = SSA_step.ssa_rhs ;
414
+ }
415
+ else if (SSA_step.is_decl ())
416
+ {
417
+ goto_trace_step.lhs = SSA_step.ssa_lhs ;
418
+ }
410
419
411
420
if (ssa_step_it == last_step_to_keep)
412
421
return ;
You can’t perform that action at this time.
0 commit comments