Skip to content

Commit 0e2978b

Browse files
committed
formatting of debug output of traces
1 parent f891f37 commit 0e2978b

File tree

1 file changed

+20
-37
lines changed

1 file changed

+20
-37
lines changed

src/goto-programs/goto_trace.cpp

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Author: Daniel Kroening
1717
#include <ostream>
1818

1919
#include <util/arith_tools.h>
20+
#include <util/format_expr.h>
2021
#include <util/symbol.h>
2122

2223
#include <ansi-c/printf_formatter.h>
@@ -67,55 +68,37 @@ void goto_trace_stept::output(
6768
if(hidden)
6869
out << " hidden";
6970

70-
out << "\n";
71+
out << '\n';
72+
73+
if(type==typet::ASSIGNMENT)
74+
{
75+
out << " " << format(full_lhs)
76+
<< " = " << format(full_lhs_value)
77+
<< '\n';
78+
}
7179

7280
if(!pc->source_location.is_nil())
73-
out << pc->source_location << "\n";
74-
75-
if(pc->is_goto())
76-
out << "GOTO ";
77-
else if(pc->is_assume())
78-
out << "ASSUME ";
79-
else if(pc->is_assert())
80-
out << "ASSERT ";
81-
else if(pc->is_dead())
82-
out << "DEAD ";
83-
else if(pc->is_other())
84-
out << "OTHER ";
85-
else if(pc->is_assign())
86-
out << "ASSIGN ";
87-
else if(pc->is_decl())
88-
out << "DECL ";
89-
else if(pc->is_function_call())
90-
out << "CALL ";
91-
else
92-
out << "(?) ";
81+
out << pc->source_location << '\n';
9382

94-
out << "\n";
83+
out << pc->type << '\n';
9584

96-
if((pc->is_other() && lhs_object.is_not_nil()) || pc->is_assign())
97-
{
98-
irep_idt identifier=lhs_object.get_object_name();
99-
out << " " << from_expr(ns, identifier, lhs_object.get_original_expr())
100-
<< " = " << from_expr(ns, identifier, lhs_object_value)
101-
<< "\n";
102-
}
103-
else if(pc->is_assert())
85+
if(pc->is_assert())
10486
{
10587
if(!cond_value)
10688
{
107-
out << "Violated property:" << "\n";
89+
out << "Violated property:" << '\n';
10890
if(pc->source_location.is_nil())
109-
out << " " << pc->source_location << "\n";
91+
out << " " << pc->source_location << '\n';
11092

111-
if(comment!="")
112-
out << " " << comment << "\n";
113-
out << " " << from_expr(ns, pc->function, pc->guard) << "\n";
114-
out << "\n";
93+
if(!comment.empty())
94+
out << " " << comment << '\n';
95+
96+
out << " " << format(pc->guard) << '\n';
97+
out << '\n';
11598
}
11699
}
117100

118-
out << "\n";
101+
out << '\n';
119102
}
120103

121104
std::string trace_value_binary(

0 commit comments

Comments
 (0)