@@ -274,11 +274,42 @@ void trace_value(
274
274
out << ' \n ' ;
275
275
}
276
276
277
+ static std::string
278
+ state_location (const goto_trace_stept &state, const namespacet &ns)
279
+ {
280
+ std::string result;
281
+
282
+ const auto &source_location = state.pc ->source_location ;
283
+
284
+ if (!source_location.get_file ().empty ())
285
+ result += " file " + id2string (source_location.get_file ());
286
+
287
+ if (!state.function .empty ())
288
+ {
289
+ const symbolt &symbol = ns.lookup (state.function );
290
+ if (!result.empty ())
291
+ result += ' ' ;
292
+ result += " function " + id2string (symbol.display_name ());
293
+ }
294
+
295
+ if (!source_location.get_line ().empty ())
296
+ {
297
+ if (!result.empty ())
298
+ result += ' ' ;
299
+ result += " line " + id2string (source_location.get_line ());
300
+ }
301
+
302
+ if (!result.empty ())
303
+ result += ' ' ;
304
+ result += " thread " + std::to_string (state.thread_nr );
305
+
306
+ return result;
307
+ }
308
+
277
309
void show_state_header (
278
310
messaget::mstreamt &out,
279
311
const namespacet &ns,
280
312
const goto_trace_stept &state,
281
- const source_locationt &source_location,
282
313
unsigned step_nr,
283
314
const trace_optionst &options)
284
315
{
@@ -289,7 +320,7 @@ void show_state_header(
289
320
else
290
321
out << " State " << step_nr;
291
322
292
- out << ' ' << source_location << " thread " << state. thread_nr << ' \n ' ;
323
+ out << state_location ( state, ns) << ' \n ' ;
293
324
out << " ----------------------------------------------------" << ' \n ' ;
294
325
295
326
if (options.show_code )
@@ -335,7 +366,10 @@ void show_full_goto_trace(
335
366
out << ' \n ' ;
336
367
out << messaget::red << " Violated property:" << messaget::reset << ' \n ' ;
337
368
if (!step.pc ->source_location .is_nil ())
338
- out << " " << step.pc ->source_location << ' \n ' ;
369
+ {
370
+ out << " " << state_location (step, ns) << ' \n ' ;
371
+ }
372
+
339
373
out << " " << messaget::red << step.comment << messaget::reset << ' \n ' ;
340
374
341
375
if (step.pc ->is_assert ())
@@ -376,8 +410,7 @@ void show_full_goto_trace(
376
410
{
377
411
first_step=false ;
378
412
prev_step_nr=step.step_nr ;
379
- show_state_header (
380
- out, ns, step, step.pc ->source_location , step.step_nr , options);
413
+ show_state_header (out, ns, step, step.step_nr , options);
381
414
}
382
415
383
416
trace_value (
@@ -395,8 +428,7 @@ void show_full_goto_trace(
395
428
{
396
429
first_step=false ;
397
430
prev_step_nr=step.step_nr ;
398
- show_state_header (
399
- out, ns, step, step.pc ->source_location , step.step_nr , options);
431
+ show_state_header (out, ns, step, step.step_nr , options);
400
432
}
401
433
402
434
trace_value (
@@ -413,8 +445,7 @@ void show_full_goto_trace(
413
445
}
414
446
else
415
447
{
416
- show_state_header (
417
- out, ns, step, step.pc ->source_location , step.step_nr , options);
448
+ show_state_header (out, ns, step, step.step_nr , options);
418
449
out << " OUTPUT " << step.io_id << ' :' ;
419
450
420
451
for (std::list<exprt>::const_iterator
@@ -436,8 +467,7 @@ void show_full_goto_trace(
436
467
break ;
437
468
438
469
case goto_trace_stept::typet::INPUT:
439
- show_state_header (
440
- out, ns, step, step.pc ->source_location , step.step_nr , options);
470
+ show_state_header (out, ns, step, step.step_nr , options);
441
471
out << " INPUT " << step.io_id << ' :' ;
442
472
443
473
for (std::list<exprt>::const_iterator
0 commit comments