@@ -279,11 +279,42 @@ void trace_value(
279279 out << ' \n ' ;
280280}
281281
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+
282314void show_state_header (
283315 messaget::mstreamt &out,
284316 const namespacet &ns,
285317 const goto_trace_stept &state,
286- const source_locationt &source_location,
287318 unsigned step_nr,
288319 const trace_optionst &options)
289320{
@@ -294,7 +325,7 @@ void show_state_header(
294325 else
295326 out << " State " << step_nr;
296327
297- out << ' ' << source_location << " thread " << state. thread_nr << ' \n ' ;
328+ out << ' ' << state_location ( state, ns) << ' \n ' ;
298329 out << " ----------------------------------------------------" << ' \n ' ;
299330
300331 if (options.show_code )
@@ -340,7 +371,10 @@ void show_full_goto_trace(
340371 out << ' \n ' ;
341372 out << messaget::red << " Violated property:" << messaget::reset << ' \n ' ;
342373 if (!step.pc ->source_location .is_nil ())
343- out << " " << step.pc ->source_location << ' \n ' ;
374+ {
375+ out << " " << state_location (step, ns) << ' \n ' ;
376+ }
377+
344378 out << " " << messaget::red << step.comment << messaget::reset << ' \n ' ;
345379
346380 if (step.pc ->is_assert ())
@@ -381,8 +415,7 @@ void show_full_goto_trace(
381415 {
382416 first_step=false ;
383417 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);
386419 }
387420
388421 trace_value (
@@ -400,8 +433,7 @@ void show_full_goto_trace(
400433 {
401434 first_step=false ;
402435 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);
405437 }
406438
407439 trace_value (
@@ -418,8 +450,7 @@ void show_full_goto_trace(
418450 }
419451 else
420452 {
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);
423454 out << " OUTPUT " << step.io_id << ' :' ;
424455
425456 for (std::list<exprt>::const_iterator
@@ -441,8 +472,7 @@ void show_full_goto_trace(
441472 break ;
442473
443474 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);
446476 out << " INPUT " << step.io_id << ' :' ;
447477
448478 for (std::list<exprt>::const_iterator
0 commit comments