57 std::ostream &out)
const
59 for(
const auto &step :
steps)
65 std::ostream &out)
const
82 out <<
"ATOMIC_BEGIN";
89 out <<
"FUNCTION RETURN";
break;
114 if(!
pc->source_location().is_nil())
115 out <<
pc->source_location() <<
'\n';
117 out <<
pc->type() <<
'\n';
123 out <<
"Violated property:" <<
'\n';
124 if(
pc->source_location().is_nil())
125 out <<
" " <<
pc->source_location() <<
'\n';
170 const typet &underlying_type =
192 std::ostringstream
oss;
193 std::string::size_type i = 0;
194 for(
const auto c : result)
197 if(++i %
config.
ansi_c.char_width == 0 && result.size() != i)
201 return prefix +
oss.str();
235 if(i.has_value() && *i >= 0)
257 for(
const auto &op : expr.
operands())
270 std::string result=
"{ ";
292 const std::optional<symbol_exprt> &
lhs_object,
293 const exprt &full_lhs,
302 out <<
from_expr(ns, identifier, full_lhs) <<
'=';
305 out <<
"(assignment removed)";
323 const auto &source_location = state.
pc->source_location();
325 if(!source_location.get_file().empty())
326 result +=
"file " +
id2string(source_location.get_file());
336 if(!source_location.get_line().empty())
340 result +=
"line " +
id2string(source_location.get_line());
345 result +=
"thread " + std::to_string(state.
thread_nr);
360 out <<
"Initial State";
362 out <<
"State " << step_nr;
365 out <<
"----------------------------------------------------" <<
'\n';
370 out <<
"----------------------------------------------------" <<
'\n';
410 if(!step.pc->source_location().is_nil())
415 if(step.pc->is_assert())
418 <<
from_expr(ns, step.function_id, step.original_condition)
428 step.assignment_type ==
436 if(!step.pc->source_location().get_line().empty())
445 step.get_lhs_object(),
454 if(!step.pc->source_location().get_file().empty())
458 if(!step.pc->source_location().get_line().empty())
461 << step.pc->source_location().get_line();
475 .map([&ns, &step](
const exprt &arg) {
476 return from_expr(ns, step.function_id, arg);
536 if(!step.pc->source_location().is_nil())
543 if(step.pc->is_assert())
546 <<
from_expr(ns, step.function_id, step.original_condition)
555 if(step.cond_value && step.pc->is_assume())
558 out <<
"Assumption:\n";
560 if(!step.pc->source_location().is_nil())
563 out <<
" " <<
from_expr(ns, step.function_id, step.original_condition)
576 step.pc->is_assign() ||
577 step.pc->is_set_return_value() ||
578 step.pc->is_function_call() ||
579 (step.pc->is_other() && step.full_lhs.is_not_nil()))
592 step.get_lhs_object(),
609 out, ns, step.get_lhs_object(), step.full_lhs, step.full_lhs_value, options);
623 out <<
" OUTPUT " << step.io_id <<
':';
625 for(std::list<exprt>::const_iterator
626 l_it=step.io_args.begin();
627 l_it!=step.io_args.end();
630 if(
l_it!=step.io_args.begin())
645 out <<
" INPUT " << step.io_id <<
':';
647 for(std::list<exprt>::const_iterator
648 l_it=step.io_args.begin();
649 l_it!=step.io_args.end();
652 if(
l_it!=step.io_args.begin())
668 out <<
"\n#### Function call: " << step.called_function;
672 for(
auto &arg : step.function_arguments)
679 out <<
from_expr(ns, step.function_id, arg);
690 out <<
"\n#### Function return from " << step.function_id <<
" (depth "
717 std::map<unsigned, std::vector<goto_tracet::stepst::const_iterator>>
726 const auto &step = *
s_it;
733 stack.push_back(
s_it);
737 else if(step.is_function_call())
739 stack.push_back(
s_it);
741 else if(step.is_function_return())
750 for(
auto s_it = stack.rbegin();
s_it != stack.rend();
s_it++)
752 const auto &step = **
s_it;
755 out <<
" assertion failure";
756 if(!step.pc->source_location().is_nil())
760 else if(step.is_function_call())
762 out <<
" " << step.called_function;
766 for(
auto &arg : step.function_arguments)
773 out <<
from_expr(ns, step.function_id, arg);
778 if(!step.pc->source_location().is_nil())
804 std::set<irep_idt> property_ids;
805 for(
const auto &step :
steps)
807 if(step.is_assert() && !step.cond_value)
808 property_ids.insert(step.property_id);
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
Expression classes for byte-level operators.
const byte_extract_exprt & to_byte_extract_expr(const exprt &expr)
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
virtual void output(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program, std::ostream &out) const
Output the abstract states for a single function.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
struct configt::ansi_ct ansi_c
A constant literal expression.
const irep_idt & get_value() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_constant() const
Return whether the expression is a constant.
typet & type()
Return the type of the expression.
Step of the trace of a GOTO program.
std::vector< exprt > function_arguments
bool is_function_call() const
bool is_assignment() const
goto_programt::const_targett pc
void merge_ireps(merge_irept &dest)
Use dest to establish sharing among ireps.
std::optional< symbol_exprt > get_lhs_object() const
void output(const class namespacet &ns, std::ostream &out) const
Outputs the trace step in ASCII to a given stream.
std::set< irep_idt > get_failed_property_ids() const
Returns the property IDs of all failed assertions in the trace.
void output(const class namespacet &ns, std::ostream &out) const
Outputs the trace in ASCII to a given stream.
const irep_idt & id() const
source_locationt source_location
static const commandt reset
return to default formatting, as defined by the terminal
static const commandt faint
render text with faint font
static const commandt red
render text with red foreground color
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const irep_idt & display_name() const
Return language specific display name if present.
The type of an expression, extends irept.
Fixed-width bit-vector with unsigned binary interpretation.
#define forall_operands(it, expr)
static void show_goto_stack_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace)
void show_state_header(messaget::mstreamt &out, const namespacet &ns, const goto_trace_stept &state, std::size_t step_nr, const trace_optionst &options)
static std::string state_location(const goto_trace_stept &state, const namespacet &ns)
std::string trace_numeric_value(const exprt &expr, const namespacet &ns, const trace_optionst &options)
static std::string numeric_representation(const constant_exprt &expr, const namespacet &ns, const trace_optionst &options)
Returns the numeric representation of an expression, based on options.
void show_full_goto_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace, const trace_optionst &options)
void show_goto_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace, const trace_optionst &options)
Output the trace on the given stream out.
bool is_index_member_symbol(const exprt &src)
static void trace_value(messaget::mstreamt &out, const namespacet &ns, const std::optional< symbol_exprt > &lhs_object, const exprt &full_lhs, const exprt &value, const trace_optionst &options)
void show_compact_goto_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace, const trace_optionst &options)
show a compact variant of the goto trace on the console
static std::optional< symbol_exprt > get_object_rec(const exprt &src)
const std::string & id2string(const irep_idt &d)
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
const std::string integer2string(const mp_integer &n, unsigned base)
const std::string integer2binary(const mp_integer &n, std::size_t width)
const annotated_pointer_constant_exprt & to_annotated_pointer_constant_expr(const exprt &expr)
Cast an exprt to an annotated_pointer_constant_exprt.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
#define UNREACHABLE
This should be used to mark dead code.
std::string as_string(const ai_verifier_statust &status)
Makes a status message string from a status.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
Options for printing the trace using show_goto_trace.
static const trace_optionst default_options
bool hex_representation
Represent plain trace values in hex.
bool base_prefix
Use prefix (0b or 0x) for distinguishing the base of the representation.
bool show_code
Show original code in plain text trace.
bool compact_trace
Give a compact trace.
bool show_function_calls
Show function calls in plain text trace.
bool stack_trace
Give a stack trace only.