@@ -279,11 +279,42 @@ void trace_value(
279
279
out << ' \n ' ;
280
280
}
281
281
282
+ static std::string
283
+ state_location (const goto_trace_stept &state, const namespacet &ns)
284
+ {
285
+ std::string result;
286
+
287
+ const auto &source_location = state.pc ->source_location ;
288
+
289
+ if (!source_location.get_file ().empty ())
290
+ result += " file " + id2string (source_location.get_file ());
291
+
292
+ if (!state.function .empty ())
293
+ {
294
+ const symbolt &symbol = ns.lookup (state.function );
295
+ if (!result.empty ())
296
+ result += ' ' ;
297
+ result += " function " + id2string (symbol.display_name ());
298
+ }
299
+
300
+ if (!source_location.get_line ().empty ())
301
+ {
302
+ if (!result.empty ())
303
+ result += ' ' ;
304
+ result += " line " + id2string (source_location.get_line ());
305
+ }
306
+
307
+ if (!result.empty ())
308
+ result += ' ' ;
309
+ result += " thread " + std::to_string (state.thread_nr );
310
+
311
+ return result;
312
+ }
313
+
282
314
void show_state_header (
283
315
messaget::mstreamt &out,
284
316
const namespacet &ns,
285
317
const goto_trace_stept &state,
286
- const source_locationt &source_location,
287
318
unsigned step_nr,
288
319
const trace_optionst &options)
289
320
{
@@ -294,7 +325,7 @@ void show_state_header(
294
325
else
295
326
out << " State " << step_nr;
296
327
297
- out << ' ' << source_location << " thread " << state. thread_nr << ' \n ' ;
328
+ out << ' ' << state_location ( state, ns) << ' \n ' ;
298
329
out << " ----------------------------------------------------" << ' \n ' ;
299
330
300
331
if (options.show_code )
@@ -340,7 +371,10 @@ void show_full_goto_trace(
340
371
out << ' \n ' ;
341
372
out << messaget::red << " Violated property:" << messaget::reset << ' \n ' ;
342
373
if (!step.pc ->source_location .is_nil ())
343
- out << " " << step.pc ->source_location << ' \n ' ;
374
+ {
375
+ out << " " << state_location (step, ns) << ' \n ' ;
376
+ }
377
+
344
378
out << " " << messaget::red << step.comment << messaget::reset << ' \n ' ;
345
379
346
380
if (step.pc ->is_assert ())
@@ -381,8 +415,7 @@ void show_full_goto_trace(
381
415
{
382
416
first_step=false ;
383
417
prev_step_nr=step.step_nr ;
384
- show_state_header (
385
- out, ns, step, step.pc ->source_location , step.step_nr , options);
418
+ show_state_header (out, ns, step, step.step_nr , options);
386
419
}
387
420
388
421
trace_value (
@@ -400,8 +433,7 @@ void show_full_goto_trace(
400
433
{
401
434
first_step=false ;
402
435
prev_step_nr=step.step_nr ;
403
- show_state_header (
404
- out, ns, step, step.pc ->source_location , step.step_nr , options);
436
+ show_state_header (out, ns, step, step.step_nr , options);
405
437
}
406
438
407
439
trace_value (
@@ -418,8 +450,7 @@ void show_full_goto_trace(
418
450
}
419
451
else
420
452
{
421
- show_state_header (
422
- out, ns, step, step.pc ->source_location , step.step_nr , options);
453
+ show_state_header (out, ns, step, step.step_nr , options);
423
454
out << " OUTPUT " << step.io_id << ' :' ;
424
455
425
456
for (std::list<exprt>::const_iterator
@@ -441,8 +472,7 @@ void show_full_goto_trace(
441
472
break ;
442
473
443
474
case goto_trace_stept::typet::INPUT:
444
- show_state_header (
445
- out, ns, step, step.pc ->source_location , step.step_nr , options);
475
+ show_state_header (out, ns, step, step.step_nr , options);
446
476
out << " INPUT " << step.io_id << ' :' ;
447
477
448
478
for (std::list<exprt>::const_iterator
0 commit comments