CBMC
goto_trace.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Traces of GOTO Programs
4 
5 Author: Daniel Kroening
6 
7  Date: July 2005
8 
9 \*******************************************************************/
10 
13 
14 #include "goto_trace.h"
15 
16 #include <util/arith_tools.h>
17 #include <util/byte_operators.h>
18 #include <util/c_types.h>
19 #include <util/config.h>
20 #include <util/format_expr.h>
21 #include <util/merge_irep.h>
22 #include <util/namespace.h>
23 #include <util/range.h>
24 #include <util/string_utils.h>
25 #include <util/symbol.h>
26 
28 #include <langapi/language_util.h>
29 
30 #include <ostream>
31 
32 static std::optional<symbol_exprt> get_object_rec(const exprt &src)
33 {
34  if(src.id()==ID_symbol)
35  return to_symbol_expr(src);
36  else if(src.id()==ID_member)
37  return get_object_rec(to_member_expr(src).struct_op());
38  else if(src.id()==ID_index)
39  return get_object_rec(to_index_expr(src).array());
40  else if(src.id()==ID_typecast)
41  return get_object_rec(to_typecast_expr(src).op());
42  else if(
43  src.id() == ID_byte_extract_little_endian ||
44  src.id() == ID_byte_extract_big_endian)
45  {
46  return get_object_rec(to_byte_extract_expr(src).op());
47  }
48  else
49  return {}; // give up
50 }
51 
52 std::optional<symbol_exprt> goto_trace_stept::get_lhs_object() const
53 {
54  return get_object_rec(full_lhs);
55 }
56 
58  const class namespacet &ns,
59  std::ostream &out) const
60 {
61  for(const auto &step : steps)
62  step.output(ns, out);
63 }
64 
66  const namespacet &,
67  std::ostream &out) const
68 {
69  out << "*** ";
70 
71  // clang-format off
72  switch(type)
73  {
74  case goto_trace_stept::typet::ASSERT: out << "ASSERT"; break;
75  case goto_trace_stept::typet::ASSUME: out << "ASSUME"; break;
76  case goto_trace_stept::typet::LOCATION: out << "LOCATION"; break;
77  case goto_trace_stept::typet::ASSIGNMENT: out << "ASSIGNMENT"; break;
78  case goto_trace_stept::typet::GOTO: out << "GOTO"; break;
79  case goto_trace_stept::typet::DECL: out << "DECL"; break;
80  case goto_trace_stept::typet::DEAD: out << "DEAD"; break;
81  case goto_trace_stept::typet::OUTPUT: out << "OUTPUT"; break;
82  case goto_trace_stept::typet::INPUT: out << "INPUT"; break;
84  out << "ATOMIC_BEGIN";
85  break;
86  case goto_trace_stept::typet::ATOMIC_END: out << "ATOMIC_END"; break;
87  case goto_trace_stept::typet::SHARED_READ: out << "SHARED_READ"; break;
88  case goto_trace_stept::typet::SHARED_WRITE: out << "SHARED WRITE"; break;
89  case goto_trace_stept::typet::FUNCTION_CALL: out << "FUNCTION CALL"; break;
91  out << "FUNCTION RETURN"; break;
92  case goto_trace_stept::typet::MEMORY_BARRIER: out << "MEMORY_BARRIER"; break;
93  case goto_trace_stept::typet::SPAWN: out << "SPAWN"; break;
94  case goto_trace_stept::typet::CONSTRAINT: out << "CONSTRAINT"; break;
95  case goto_trace_stept::typet::NONE: out << "NONE"; break;
96  }
97  // clang-format on
98 
99  if(is_assert() || is_assume() || is_goto())
100  out << " (" << cond_value << ')';
101  else if(is_function_call())
102  out << ' ' << called_function;
103 
104  if(hidden)
105  out << " hidden";
106 
107  out << '\n';
108 
109  if(is_assignment())
110  {
111  out << " " << format(full_lhs)
112  << " = " << format(full_lhs_value)
113  << '\n';
114  }
115 
116  if(!pc->source_location().is_nil())
117  out << pc->source_location() << '\n';
118 
119  out << pc->type() << '\n';
120 
121  if(pc->is_assert())
122  {
123  if(!cond_value)
124  {
125  out << "Violated property:" << '\n';
126  if(pc->source_location().is_nil())
127  out << " " << pc->source_location() << '\n';
128 
129  if(!comment.empty())
130  out << " " << comment << '\n';
131 
132  out << " " << format(original_condition) << '\n';
133  out << '\n';
134  }
135  }
136 
137  out << '\n';
138 }
139 
141 {
142  dest(cond_expr);
143  dest(full_lhs);
144  dest(full_lhs_value);
145 
146  for(auto &io_arg : io_args)
147  dest(io_arg);
148 
149  for(auto &function_arg : function_arguments)
150  dest(function_arg);
151 }
152 
162 static std::string numeric_representation(
163  const constant_exprt &expr,
164  const namespacet &ns,
165  const trace_optionst &options)
166 {
167  std::string result;
168  std::string prefix;
169 
170  const typet &expr_type = expr.type();
171 
172  const typet &underlying_type =
173  expr_type.id() == ID_c_enum_tag
174  ? ns.follow_tag(to_c_enum_tag_type(expr_type)).underlying_type()
175  : expr_type;
176 
177  const irep_idt &value = expr.get_value();
178 
179  const auto width = to_bitvector_type(underlying_type).get_width();
180 
181  const mp_integer value_int = bvrep2integer(id2string(value), width, false);
182 
183  if(options.hex_representation)
184  {
185  result = integer2string(value_int, 16);
186  prefix = "0x";
187  }
188  else
189  {
190  result = integer2binary(value_int, width);
191  prefix = "0b";
192  }
193 
194  std::ostringstream oss;
196  for(const auto c : result)
197  {
198  oss << c;
199  if(++i % config.ansi_c.char_width == 0 && result.size() != i)
200  oss << ' ';
201  }
202  if(options.base_prefix)
203  return prefix + oss.str();
204  else
205  return oss.str();
206 }
207 
209  const exprt &expr,
210  const namespacet &ns,
211  const trace_optionst &options)
212 {
213  const typet &type = expr.type();
214 
215  if(expr.is_constant())
216  {
217  if(type.id()==ID_unsignedbv ||
218  type.id()==ID_signedbv ||
219  type.id()==ID_bv ||
220  type.id()==ID_fixedbv ||
221  type.id()==ID_floatbv ||
222  type.id()==ID_pointer ||
223  type.id()==ID_c_bit_field ||
224  type.id()==ID_c_bool ||
225  type.id()==ID_c_enum ||
226  type.id()==ID_c_enum_tag)
227  {
228  return numeric_representation(to_constant_expr(expr), ns, options);
229  }
230  else if(type.id()==ID_bool)
231  {
232  return expr.is_true()?"1":"0";
233  }
234  else if(type.id()==ID_integer)
235  {
236  const auto i = numeric_cast<mp_integer>(expr);
237  if(i.has_value() && *i >= 0)
238  {
239  if(options.hex_representation)
240  return "0x" + integer2string(*i, 16);
241  else
242  return "0b" + integer2string(*i, 2);
243  }
244  }
245  }
246  else if(expr.id() == ID_annotated_pointer_constant)
247  {
248  const auto &annotated_pointer_constant =
250  auto width = to_pointer_type(expr.type()).get_width();
251  auto &value = annotated_pointer_constant.get_value();
252  auto c = constant_exprt(value, unsignedbv_typet(width));
253  return numeric_representation(c, ns, options);
254  }
255  else if(expr.id()==ID_array)
256  {
257  std::string result;
258 
259  for(const auto &op : expr.operands())
260  {
261  if(result.empty())
262  result="{ ";
263  else
264  result+=", ";
265  result += trace_numeric_value(op, ns, options);
266  }
267 
268  return result+" }";
269  }
270  else if(expr.id()==ID_struct)
271  {
272  std::string result="{ ";
273 
274  forall_operands(it, expr)
275  {
276  if(it!=expr.operands().begin())
277  result+=", ";
278  result+=trace_numeric_value(*it, ns, options);
279  }
280 
281  return result+" }";
282  }
283  else if(expr.id()==ID_union)
284  {
285  return trace_numeric_value(to_union_expr(expr).op(), ns, options);
286  }
287 
288  return "?";
289 }
290 
291 static void trace_value(
292  messaget::mstreamt &out,
293  const namespacet &ns,
294  const std::optional<symbol_exprt> &lhs_object,
295  const exprt &full_lhs,
296  const exprt &value,
297  const trace_optionst &options)
298 {
299  irep_idt identifier;
300 
301  if(lhs_object.has_value())
302  identifier=lhs_object->get_identifier();
303 
304  out << from_expr(ns, identifier, full_lhs) << '=';
305 
306  if(value.is_nil())
307  out << "(assignment removed)";
308  else
309  {
310  out << from_expr(ns, identifier, value);
311 
312  // the binary representation
313  out << ' ' << messaget::faint << '('
314  << trace_numeric_value(value, ns, options) << ')' << messaget::reset;
315  }
316 
317  out << '\n';
318 }
319 
320 static std::string
322 {
323  std::string result;
324 
325  const auto &source_location = state.pc->source_location();
326 
327  if(!source_location.get_file().empty())
328  result += "file " + id2string(source_location.get_file());
329 
330  if(!state.function_id.empty())
331  {
332  const symbolt &symbol = ns.lookup(state.function_id);
333  if(!result.empty())
334  result += ' ';
335  result += "function " + id2string(symbol.display_name());
336  }
337 
338  if(!source_location.get_line().empty())
339  {
340  if(!result.empty())
341  result += ' ';
342  result += "line " + id2string(source_location.get_line());
343  }
344 
345  if(!result.empty())
346  result += ' ';
347  result += "thread " + std::to_string(state.thread_nr);
348 
349  return result;
350 }
351 
353  messaget::mstreamt &out,
354  const namespacet &ns,
355  const goto_trace_stept &state,
356  unsigned step_nr,
357  const trace_optionst &options)
358 {
359  out << '\n';
360 
361  if(step_nr == 0)
362  out << "Initial State";
363  else
364  out << "State " << step_nr;
365 
366  out << ' ' << state_location(state, ns) << '\n';
367  out << "----------------------------------------------------" << '\n';
368 
369  if(options.show_code)
370  {
371  out << as_string(ns, state.function_id, *state.pc) << '\n';
372  out << "----------------------------------------------------" << '\n';
373  }
374 }
375 
377 {
378  if(src.id()==ID_index)
379  return is_index_member_symbol(to_index_expr(src).array());
380  else if(src.id()==ID_member)
381  return is_index_member_symbol(to_member_expr(src).compound());
382  else if(src.id()==ID_symbol)
383  return true;
384  else
385  return false;
386 }
387 
394  messaget::mstreamt &out,
395  const namespacet &ns,
396  const goto_tracet &goto_trace,
397  const trace_optionst &options)
398 {
399  for(const auto &step : goto_trace.steps)
400  {
401  // hide the hidden ones
402  if(step.hidden)
403  continue;
404 
405  switch(step.type)
406  {
408  if(!step.cond_value)
409  {
410  out << '\n';
411  out << messaget::red << "Violated property:" << messaget::reset << '\n';
412  if(!step.pc->source_location().is_nil())
413  out << " " << state_location(step, ns) << '\n';
414 
415  out << " " << messaget::red << step.comment << messaget::reset << '\n';
416 
417  if(step.pc->is_assert())
418  {
419  out << " "
420  << from_expr(ns, step.function_id, step.original_condition)
421  << '\n';
422  }
423 
424  out << '\n';
425  }
426  break;
427 
429  if(
430  step.assignment_type ==
432  {
433  break;
434  }
435 
436  out << " ";
437 
438  if(!step.pc->source_location().get_line().empty())
439  {
440  out << messaget::faint << step.pc->source_location().get_line() << ':'
441  << messaget::reset << ' ';
442  }
443 
444  trace_value(
445  out,
446  ns,
447  step.get_lhs_object(),
448  step.full_lhs,
449  step.full_lhs_value,
450  options);
451  break;
452 
454  // downwards arrow
455  out << '\n' << messaget::faint << u8"\u21b3" << messaget::reset << ' ';
456  if(!step.pc->source_location().get_file().empty())
457  {
458  out << messaget::faint << step.pc->source_location().get_file();
459 
460  if(!step.pc->source_location().get_line().empty())
461  {
462  out << messaget::faint << ':'
463  << step.pc->source_location().get_line();
464  }
465 
466  out << messaget::reset << ' ';
467  }
468 
469  {
470  // show the display name
471  const auto &f_symbol = ns.lookup(step.called_function);
472  out << f_symbol.display_name();
473  }
474 
475  {
476  auto arg_strings = make_range(step.function_arguments)
477  .map([&ns, &step](const exprt &arg) {
478  return from_expr(ns, step.function_id, arg);
479  });
480 
481  out << '(';
482  join_strings(out, arg_strings.begin(), arg_strings.end(), ", ");
483  out << ")\n";
484  }
485 
486  break;
487 
489  // upwards arrow
490  out << messaget::faint << u8"\u21b5" << messaget::reset << '\n';
491  break;
492 
507  break;
508 
510  UNREACHABLE;
511  }
512  }
513 }
514 
516  messaget::mstreamt &out,
517  const namespacet &ns,
518  const goto_tracet &goto_trace,
519  const trace_optionst &options)
520 {
521  unsigned prev_step_nr=0;
522  bool first_step=true;
523  std::size_t function_depth=0;
524 
525  for(const auto &step : goto_trace.steps)
526  {
527  // hide the hidden ones
528  if(step.hidden)
529  continue;
530 
531  switch(step.type)
532  {
534  if(!step.cond_value)
535  {
536  out << '\n';
537  out << messaget::red << "Violated property:" << messaget::reset << '\n';
538  if(!step.pc->source_location().is_nil())
539  {
540  out << " " << state_location(step, ns) << '\n';
541  }
542 
543  out << " " << messaget::red << step.comment << messaget::reset << '\n';
544 
545  if(step.pc->is_assert())
546  {
547  out << " "
548  << from_expr(ns, step.function_id, step.original_condition)
549  << '\n';
550  }
551 
552  out << '\n';
553  }
554  break;
555 
557  if(step.cond_value && step.pc->is_assume())
558  {
559  out << "\n";
560  out << "Assumption:\n";
561 
562  if(!step.pc->source_location().is_nil())
563  out << " " << step.pc->source_location() << '\n';
564 
565  out << " " << from_expr(ns, step.function_id, step.original_condition)
566  << '\n';
567  }
568  break;
569 
571  break;
572 
574  break;
575 
577  if(
578  step.pc->is_assign() ||
579  step.pc->is_set_return_value() || // returns have a lhs!
580  step.pc->is_function_call() ||
581  (step.pc->is_other() && step.full_lhs.is_not_nil()))
582  {
583  if(prev_step_nr!=step.step_nr || first_step)
584  {
585  first_step=false;
586  prev_step_nr=step.step_nr;
587  show_state_header(out, ns, step, step.step_nr, options);
588  }
589 
590  out << " ";
591  trace_value(
592  out,
593  ns,
594  step.get_lhs_object(),
595  step.full_lhs,
596  step.full_lhs_value,
597  options);
598  }
599  break;
600 
602  if(prev_step_nr!=step.step_nr || first_step)
603  {
604  first_step=false;
605  prev_step_nr=step.step_nr;
606  show_state_header(out, ns, step, step.step_nr, options);
607  }
608 
609  out << " ";
610  trace_value(
611  out, ns, step.get_lhs_object(), step.full_lhs, step.full_lhs_value, options);
612  break;
613 
615  if(step.formatted)
616  {
617  printf_formattert printf_formatter(ns);
618  printf_formatter(id2string(step.format_string), step.io_args);
619  printf_formatter.print(out);
620  out << '\n';
621  }
622  else
623  {
624  show_state_header(out, ns, step, step.step_nr, options);
625  out << " OUTPUT " << step.io_id << ':';
626 
627  for(std::list<exprt>::const_iterator
628  l_it=step.io_args.begin();
629  l_it!=step.io_args.end();
630  l_it++)
631  {
632  if(l_it!=step.io_args.begin())
633  out << ';';
634 
635  out << ' ' << from_expr(ns, step.function_id, *l_it);
636 
637  // the binary representation
638  out << " (" << trace_numeric_value(*l_it, ns, options) << ')';
639  }
640 
641  out << '\n';
642  }
643  break;
644 
646  show_state_header(out, ns, step, step.step_nr, options);
647  out << " INPUT " << step.io_id << ':';
648 
649  for(std::list<exprt>::const_iterator
650  l_it=step.io_args.begin();
651  l_it!=step.io_args.end();
652  l_it++)
653  {
654  if(l_it!=step.io_args.begin())
655  out << ';';
656 
657  out << ' ' << from_expr(ns, step.function_id, *l_it);
658 
659  // the binary representation
660  out << " (" << trace_numeric_value(*l_it, ns, options) << ')';
661  }
662 
663  out << '\n';
664  break;
665 
667  function_depth++;
668  if(options.show_function_calls)
669  {
670  out << "\n#### Function call: " << step.called_function;
671  out << '(';
672 
673  bool first = true;
674  for(auto &arg : step.function_arguments)
675  {
676  if(first)
677  first = false;
678  else
679  out << ", ";
680 
681  out << from_expr(ns, step.function_id, arg);
682  }
683 
684  out << ") (depth " << function_depth << ") ####\n";
685  }
686  break;
687 
689  function_depth--;
690  if(options.show_function_calls)
691  {
692  out << "\n#### Function return from " << step.function_id << " (depth "
693  << function_depth << ") ####\n";
694  }
695  break;
696 
702  break;
703 
708  UNREACHABLE;
709  }
710  }
711 }
712 
714  messaget::mstreamt &out,
715  const namespacet &ns,
716  const goto_tracet &goto_trace)
717 {
718  // map from thread number to a call stack
719  std::map<unsigned, std::vector<goto_tracet::stepst::const_iterator>>
720  call_stacks;
721 
722  // by default, we show thread 0
723  unsigned thread_to_show = 0;
724 
725  for(auto s_it = goto_trace.steps.begin(); s_it != goto_trace.steps.end();
726  s_it++)
727  {
728  const auto &step = *s_it;
729  auto &stack = call_stacks[step.thread_nr];
730 
731  if(step.is_assert())
732  {
733  if(!step.cond_value)
734  {
735  stack.push_back(s_it);
736  thread_to_show = step.thread_nr;
737  }
738  }
739  else if(step.is_function_call())
740  {
741  stack.push_back(s_it);
742  }
743  else if(step.is_function_return())
744  {
745  stack.pop_back();
746  }
747  }
748 
749  const auto &stack = call_stacks[thread_to_show];
750 
751  // print in reverse order
752  for(auto s_it = stack.rbegin(); s_it != stack.rend(); s_it++)
753  {
754  const auto &step = **s_it;
755  if(step.is_assert())
756  {
757  out << " assertion failure";
758  if(!step.pc->source_location().is_nil())
759  out << ' ' << step.pc->source_location();
760  out << '\n';
761  }
762  else if(step.is_function_call())
763  {
764  out << " " << step.called_function;
765  out << '(';
766 
767  bool first = true;
768  for(auto &arg : step.function_arguments)
769  {
770  if(first)
771  first = false;
772  else
773  out << ", ";
774 
775  out << from_expr(ns, step.function_id, arg);
776  }
777 
778  out << ')';
779 
780  if(!step.pc->source_location().is_nil())
781  out << ' ' << step.pc->source_location();
782 
783  out << '\n';
784  }
785  }
786 }
787 
789  messaget::mstreamt &out,
790  const namespacet &ns,
791  const goto_tracet &goto_trace,
792  const trace_optionst &options)
793 {
794  if(options.stack_trace)
795  show_goto_stack_trace(out, ns, goto_trace);
796  else if(options.compact_trace)
797  show_compact_goto_trace(out, ns, goto_trace, options);
798  else
799  show_full_goto_trace(out, ns, goto_trace, options);
800 }
801 
803 
804 std::set<irep_idt> goto_tracet::get_failed_property_ids() const
805 {
806  std::set<irep_idt> property_ids;
807  for(const auto &step : steps)
808  {
809  if(step.is_assert() && !step.cond_value)
810  property_ids.insert(step.property_id);
811  }
812  return property_ids;
813 }
configt config
Definition: config.cpp:25
mp_integer bvrep2integer(const irep_idt &src, std::size_t width, bool is_signed)
convert a bit-vector representation (possibly signed) to integer
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)
uint64_t u8
Definition: bytecode_info.h:58
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
Definition: c_types.h:377
std::size_t get_width() const
Definition: std_types.h:925
struct configt::ansi_ct ansi_c
A constant literal expression.
Definition: std_expr.h:3000
const irep_idt & get_value() const
Definition: std_expr.h:3008
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
bool empty() const
Definition: dstring.h:89
Base class for all expressions.
Definition: expr.h:56
bool is_true() const
Return whether the expression is a constant representing true.
Definition: expr.cpp:27
typet & type()
Return the type of the expression.
Definition: expr.h:84
bool is_constant() const
Return whether the expression is a constant.
Definition: expr.h:212
operandst & operands()
Definition: expr.h:94
Step of the trace of a GOTO program.
Definition: goto_trace.h:50
std::vector< exprt > function_arguments
Definition: goto_trace.h:145
bool is_function_call() const
Definition: goto_trace.h:60
exprt original_condition
Definition: goto_trace.h:120
bool is_assignment() const
Definition: goto_trace.h:55
std::string comment
Definition: goto_trace.h:124
exprt full_lhs_value
Definition: goto_trace.h:133
goto_programt::const_targett pc
Definition: goto_trace.h:112
irep_idt function_id
Definition: goto_trace.h:111
io_argst io_args
Definition: goto_trace.h:138
void merge_ireps(merge_irept &dest)
Use dest to establish sharing among ireps.
Definition: goto_trace.cpp:140
unsigned thread_nr
Definition: goto_trace.h:115
bool is_goto() const
Definition: goto_trace.h:58
bool is_assume() const
Definition: goto_trace.h:56
bool is_assert() const
Definition: goto_trace.h:57
irep_idt called_function
Definition: goto_trace.h:142
std::optional< symbol_exprt > get_lhs_object() const
Definition: goto_trace.cpp:52
void output(const class namespacet &ns, std::ostream &out) const
Outputs the trace step in ASCII to a given stream.
Definition: goto_trace.cpp:65
Trace of a GOTO program.
Definition: goto_trace.h:177
stepst steps
Definition: goto_trace.h:180
std::set< irep_idt > get_failed_property_ids() const
Returns the property IDs of all failed assertions in the trace.
Definition: goto_trace.cpp:804
void output(const class namespacet &ns, std::ostream &out) const
Outputs the trace in ASCII to a given stream.
Definition: goto_trace.cpp:57
const irep_idt & id() const
Definition: irep.h:388
bool is_nil() const
Definition: irep.h:368
source_locationt source_location
Definition: message.h:239
static const commandt reset
return to default formatting, as defined by the terminal
Definition: message.h:335
static const commandt faint
render text with faint font
Definition: message.h:377
static const commandt red
render text with red foreground color
Definition: message.h:338
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
Definition: namespace.cpp:63
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Definition: namespace.cpp:148
void print(std::ostream &out)
Symbol table entry.
Definition: symbol.h:28
const irep_idt & display_name() const
Return language specific display name if present.
Definition: symbol.h:55
The type of an expression, extends irept.
Definition: type.h:29
Fixed-width bit-vector with unsigned binary interpretation.
#define forall_operands(it, expr)
Definition: expr.h:20
static format_containert< T > format(const T &o)
Definition: format.h:37
static void show_goto_stack_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace)
Definition: goto_trace.cpp:713
static std::string state_location(const goto_trace_stept &state, const namespacet &ns)
Definition: goto_trace.cpp:321
void show_state_header(messaget::mstreamt &out, const namespacet &ns, const goto_trace_stept &state, unsigned step_nr, const trace_optionst &options)
Definition: goto_trace.cpp:352
std::string trace_numeric_value(const exprt &expr, const namespacet &ns, const trace_optionst &options)
Definition: goto_trace.cpp:208
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.
Definition: goto_trace.cpp:162
void show_full_goto_trace(messaget::mstreamt &out, const namespacet &ns, const goto_tracet &goto_trace, const trace_optionst &options)
Definition: goto_trace.cpp:515
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.
Definition: goto_trace.cpp:788
static std::optional< symbol_exprt > get_object_rec(const exprt &src)
Definition: goto_trace.cpp:32
bool is_index_member_symbol(const exprt &src)
Definition: goto_trace.cpp:376
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)
Definition: goto_trace.cpp:291
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
Definition: goto_trace.cpp:393
Traces of GOTO Programs.
const std::string & id2string(const irep_idt &d)
Definition: irep.h:44
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
const std::string integer2string(const mp_integer &n, unsigned base)
Definition: mp_arith.cpp:103
const std::string integer2binary(const mp_integer &n, std::size_t width)
Definition: mp_arith.cpp:64
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.
Definition: pointer_expr.h:93
printf Formatting
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
Definition: range.h:522
BigInt mp_integer
Definition: smt_terms.h:17
#define UNREACHABLE
This should be used to mark dead code.
Definition: invariant.h:525
std::string as_string(const ai_verifier_statust &status)
Makes a status message string from a status.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
Definition: std_expr.h:3055
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition: std_expr.h:272
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
Definition: std_expr.h:2107
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
Definition: std_expr.h:1816
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
Definition: std_expr.h:2946
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Definition: std_expr.h:1538
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
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.
Definition: string_utils.h:61
std::size_t char_width
Definition: config.h:140
Options for printing the trace using show_goto_trace.
Definition: goto_trace.h:221
static const trace_optionst default_options
Definition: goto_trace.h:238
bool hex_representation
Represent plain trace values in hex.
Definition: goto_trace.h:225
bool base_prefix
Use prefix (0b or 0x) for distinguishing the base of the representation.
Definition: goto_trace.h:228
bool show_code
Show original code in plain text trace.
Definition: goto_trace.h:232
bool compact_trace
Give a compact trace.
Definition: goto_trace.h:234
bool show_function_calls
Show function calls in plain text trace.
Definition: goto_trace.h:230
bool stack_trace
Give a stack trace only.
Definition: goto_trace.h:236
Symbol table entry.
#define size_type
Definition: unistd.c:347