Skip to content

Commit e82dca0

Browse files
author
Daniel Kroening
committed
formatting of debug output of traces
1 parent f891f37 commit e82dca0

File tree

1 file changed

+23
-38
lines changed

1 file changed

+23
-38
lines changed

src/goto-programs/goto_trace.cpp

+23-38
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>
@@ -61,61 +62,45 @@ void goto_trace_stept::output(
6162
UNREACHABLE;
6263
}
6364

64-
if(type==typet::ASSERT || type==typet::ASSUME || type==typet::GOTO)
65+
if(is_assert() || is_assume() || is_goto())
6566
out << " (" << cond_value << ")";
67+
else if(is_function_call() || is_function_return())
68+
out << ' ' << identifier;
6669

6770
if(hidden)
6871
out << " hidden";
6972

70-
out << "\n";
73+
out << '\n';
74+
75+
if(is_assignment())
76+
{
77+
out << " " << format(full_lhs)
78+
<< " = " << format(full_lhs_value)
79+
<< '\n';
80+
}
7181

7282
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 << "(?) ";
83+
out << pc->source_location << '\n';
9384

94-
out << "\n";
85+
out << pc->type << '\n';
9586

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())
87+
if(pc->is_assert())
10488
{
10589
if(!cond_value)
10690
{
107-
out << "Violated property:" << "\n";
91+
out << "Violated property:" << '\n';
10892
if(pc->source_location.is_nil())
109-
out << " " << pc->source_location << "\n";
93+
out << " " << pc->source_location << '\n';
11094

111-
if(comment!="")
112-
out << " " << comment << "\n";
113-
out << " " << from_expr(ns, pc->function, pc->guard) << "\n";
114-
out << "\n";
95+
if(!comment.empty())
96+
out << " " << comment << '\n';
97+
98+
out << " " << format(pc->guard) << '\n';
99+
out << '\n';
115100
}
116101
}
117102

118-
out << "\n";
103+
out << '\n';
119104
}
120105

121106
std::string trace_value_binary(

0 commit comments

Comments
 (0)