@@ -24,12 +24,32 @@ Date: July 2005
24
24
25
25
#include < goto-programs/goto_program.h>
26
26
27
- /* ! \brief TO_BE_DOCUMENTED
28
- * \ingroup gr_goto_symex
29
- */
27
+ // / Step of the trace of a GOTO program
28
+ // /
29
+ // / A step is either:
30
+ // / - an assignment
31
+ // / - an assume statement
32
+ // / - an assertion
33
+ // / - a goto instruction
34
+ // / - a constraint (unused)
35
+ // / - a function call
36
+ // / - a function return
37
+ // / - a location (unused)
38
+ // / - an output
39
+ // / - an input
40
+ // / - a declaration
41
+ // / - a dead statement
42
+ // / - a shared read (unused)
43
+ // / - a shared write (unused)
44
+ // / - a spawn statement
45
+ // / - a memory barrier
46
+ // / - an atomic begin (unused)
47
+ // / - an atomic end (unused)
48
+ // / \ingroup gr_goto_symex
30
49
class goto_trace_stept
31
50
{
32
51
public:
52
+ // / Number of the step in the trace
33
53
std::size_t step_nr;
34
54
35
55
bool is_assignment () const { return type==typet::ASSIGNMENT; }
@@ -123,8 +143,7 @@ class goto_trace_stept
123
143
// for function call
124
144
std::vector<exprt> function_arguments;
125
145
126
- /* ! \brief outputs the trace step in ASCII to a given stream
127
- */
146
+ // / Outputs the trace step in ASCII to a given stream
128
147
void output (
129
148
const class namespacet &ns,
130
149
std::ostream &out) const ;
@@ -145,66 +164,64 @@ class goto_trace_stept
145
164
}
146
165
};
147
166
148
- /* ! \brief TO_BE_DOCUMENTED
149
- * \ingroup gr_goto_symex
150
- */
167
+ // / Trace of a GOTO program.
168
+ // / This is a wrapper for a list of steps.
169
+ // / \ingroup gr_goto_symex
151
170
class goto_tracet
152
171
{
153
172
public:
154
173
typedef std::list<goto_trace_stept> stepst;
155
174
stepst steps;
156
175
157
- irep_idt mode;
158
-
159
176
void clear ()
160
177
{
161
- mode.clear ();
162
178
steps.clear ();
163
179
}
164
180
165
- /* ! \brief outputs the trace in ASCII to a given stream
166
- */
181
+ // / Outputs the trace in ASCII to a given stream
167
182
void output (
168
183
const class namespacet &ns,
169
184
std::ostream &out) const ;
170
185
171
186
void swap (goto_tracet &other)
172
187
{
173
188
other.steps .swap (steps);
174
- other.mode .swap (mode);
175
189
}
176
190
191
+ // / Add a step at the end of the trace
177
192
void add_step (const goto_trace_stept &step)
178
193
{
179
194
steps.push_back (step);
180
195
}
181
196
182
- // retrieves the final step in the trace for manipulation
183
- // (used to fill a trace from code, hence non-const)
197
+ // / Retrieves the final step in the trace for manipulation
198
+ // / (used to fill a trace from code, hence non-const)
184
199
goto_trace_stept &get_last_step ()
185
200
{
186
201
return steps.back ();
187
202
}
188
203
189
204
// / Returns the property IDs of all assertions in the trace
190
205
std::vector<irep_idt> get_all_property_ids () const ;
191
-
192
- // delete all steps after (not including) s
193
- void trim_after (stepst::iterator s)
194
- {
195
- PRECONDITION (s != steps.end ());
196
- steps.erase (++s, steps.end ());
197
- }
198
206
};
199
207
208
+ // / Options for printing the trace using show_goto_trace
200
209
struct trace_optionst
201
210
{
211
+ // / Add rawLhs property to trace
202
212
bool json_full_lhs;
213
+ // / Represent plain trace values in hex
203
214
bool hex_representation;
215
+ // / Use prefix (`0b` or `0x`) for distinguishing the base of the
216
+ // / representation.
204
217
bool base_prefix;
218
+ // / Show function calls in plain text trace
205
219
bool show_function_calls;
220
+ // / Show original code in plain text trace
206
221
bool show_code;
222
+ // / Give a compact trace
207
223
bool compact_trace;
224
+ // / Give a stack trace only
208
225
bool stack_trace;
209
226
210
227
static const trace_optionst default_options;
@@ -233,24 +250,12 @@ struct trace_optionst
233
250
};
234
251
};
235
252
253
+ // / Output the trace on the given stream \p out
236
254
void show_goto_trace (
237
255
messaget::mstreamt &out,
238
- const namespacet &,
239
- const goto_tracet &);
240
-
241
- void show_goto_trace (
242
- messaget::mstreamt &out,
243
- const namespacet &,
244
- const goto_tracet &,
245
- const trace_optionst &);
246
-
247
- void trace_value (
248
- messaget::mstreamt &out,
249
- const namespacet &,
250
- const optionalt<symbol_exprt> &lhs_object,
251
- const exprt &full_lhs,
252
- const exprt &value,
253
- const trace_optionst &);
256
+ const namespacet &ns,
257
+ const goto_tracet &goto_trace,
258
+ const trace_optionst &trace_options = trace_optionst::default_options);
254
259
255
260
#define OPT_GOTO_TRACE \
256
261
" (trace-json-extended)" \
0 commit comments