@@ -247,20 +247,30 @@ void trace_value(
247
247
248
248
void show_state_header (
249
249
std::ostream &out,
250
+ const namespacet &ns,
250
251
const goto_trace_stept &state,
251
252
const source_locationt &source_location,
252
- unsigned step_nr)
253
+ unsigned step_nr,
254
+ const trace_optionst &options)
253
255
{
254
256
out << " \n " ;
255
257
256
- if (step_nr== 0 )
258
+ if (step_nr == 0 )
257
259
out << " Initial State" ;
258
260
else
259
261
out << " State " << step_nr;
260
262
261
- out << " " << source_location
262
- << " thread " << state.thread_nr << " \n " ;
263
- out << " ----------------------------------------------------" << " \n " ;
263
+ out << " " << source_location << " thread " << state.thread_nr << " \n " ;
264
+ out << " ----------------------------------------------------"
265
+ << " \n " ;
266
+
267
+ if (options.show_code )
268
+ {
269
+ out << as_string (ns, *state.pc )
270
+ << " \n " ;
271
+ out << " ----------------------------------------------------"
272
+ << " \n " ;
273
+ }
264
274
}
265
275
266
276
bool is_index_member_symbol (const exprt &src)
@@ -283,6 +293,7 @@ void show_goto_trace(
283
293
{
284
294
unsigned prev_step_nr=0 ;
285
295
bool first_step=true ;
296
+ std::size_t function_depth=0 ;
286
297
287
298
for (const auto &step : goto_trace.steps )
288
299
{
@@ -341,7 +352,8 @@ void show_goto_trace(
341
352
{
342
353
first_step=false ;
343
354
prev_step_nr=step.step_nr ;
344
- show_state_header (out, step, step.pc ->source_location , step.step_nr );
355
+ show_state_header (
356
+ out, ns, step, step.pc ->source_location , step.step_nr , options);
345
357
}
346
358
347
359
// see if the full lhs is something clean
@@ -369,7 +381,8 @@ void show_goto_trace(
369
381
{
370
382
first_step=false ;
371
383
prev_step_nr=step.step_nr ;
372
- show_state_header (out, step, step.pc ->source_location , step.step_nr );
384
+ show_state_header (
385
+ out, ns, step, step.pc ->source_location , step.step_nr , options);
373
386
}
374
387
375
388
trace_value (
@@ -386,7 +399,8 @@ void show_goto_trace(
386
399
}
387
400
else
388
401
{
389
- show_state_header (out, step, step.pc ->source_location , step.step_nr );
402
+ show_state_header (
403
+ out, ns, step, step.pc ->source_location , step.step_nr , options);
390
404
out << " OUTPUT " << step.io_id << " :" ;
391
405
392
406
for (std::list<exprt>::const_iterator
@@ -407,7 +421,8 @@ void show_goto_trace(
407
421
break ;
408
422
409
423
case goto_trace_stept::typet::INPUT:
410
- show_state_header (out, step, step.pc ->source_location , step.step_nr );
424
+ show_state_header (
425
+ out, ns, step, step.pc ->source_location , step.step_nr , options);
411
426
out << " INPUT " << step.io_id << " :" ;
412
427
413
428
for (std::list<exprt>::const_iterator
@@ -427,7 +442,17 @@ void show_goto_trace(
427
442
break ;
428
443
429
444
case goto_trace_stept::typet::FUNCTION_CALL:
445
+ function_depth++;
446
+ if (options.show_function_calls )
447
+ out << " \n #### Function call: " << step.identifier << " (depth "
448
+ << function_depth << " ) ####\n " ;
449
+ break ;
430
450
case goto_trace_stept::typet::FUNCTION_RETURN:
451
+ function_depth--;
452
+ if (options.show_function_calls )
453
+ out << " \n #### Function return: " << step.identifier << " (depth "
454
+ << function_depth << " ) ####\n " ;
455
+ break ;
431
456
case goto_trace_stept::typet::SPAWN:
432
457
case goto_trace_stept::typet::MEMORY_BARRIER:
433
458
case goto_trace_stept::typet::ATOMIC_BEGIN:
0 commit comments