cprover
symex_bmc.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Bounded Model Checking for ANSI-C
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CBMC_SYMEX_BMC_H
13 #define CPROVER_CBMC_SYMEX_BMC_H
14 
15 #include <util/message.h>
16 #include <util/threeval.h>
17 
19 #include <goto-symex/goto_symex.h>
20 
22 
23 #include "symex_coverage.h"
24 
25 class symex_bmct: public goto_symext
26 {
27 public:
28  symex_bmct(
29  message_handlert &mh,
31  symex_target_equationt &_target,
32  const optionst &options,
34 
35  // To show progress
37 
44  typedef
45  std::function<tvt(
46  const goto_symex_statet::call_stackt &, unsigned, unsigned, unsigned &)>
48 
55  typedef std::function<tvt(const irep_idt &, unsigned, unsigned &)>
57 
63  {
64  loop_unwind_handlers.push_back(handler);
65  }
66 
72  {
73  recursion_unwind_handlers.push_back(handler);
74  }
75 
77  const goto_functionst &goto_functions,
78  const std::string &path) const
79  {
80  return symex_coverage.generate_report(goto_functions, path);
81  }
82 
84 
86 
87 protected:
89  std::vector<loop_unwind_handlert> loop_unwind_handlers;
90 
93  std::vector<recursion_unwind_handlert> recursion_unwind_handlers;
94 
95  //
96  // overloaded from goto_symext
97  //
98  virtual void symex_step(
99  const get_goto_functiont &get_goto_function,
100  statet &state);
101 
102  virtual void merge_goto(
103  const statet::goto_statet &goto_state,
104  statet &state);
105 
106  // for loop unwinding
107  virtual bool get_unwind(
108  const symex_targett::sourcet &source,
109  const goto_symex_statet::call_stackt &context,
110  unsigned unwind);
111 
112  virtual bool get_unwind_recursion(
113  const irep_idt &identifier,
114  const unsigned thread_nr,
115  unsigned unwind);
116 
117  virtual void no_body(const irep_idt &identifier);
118 
119  std::unordered_set<irep_idt> body_warnings;
120 
122 };
123 
124 #endif // CPROVER_CBMC_SYMEX_BMC_H
std::unordered_set< irep_idt > body_warnings
Definition: symex_bmc.h:119
bool record_coverage
Definition: symex_bmc.h:83
bool generate_report(const goto_functionst &goto_functions, const std::string &path) const
virtual bool get_unwind(const symex_targett::sourcet &source, const goto_symex_statet::call_stackt &context, unsigned unwind)
Definition: symex_bmc.cpp:107
std::vector< recursion_unwind_handlert > recursion_unwind_handlers
Callbacks that may provide an unwind/do-not-unwind decision for a recursive call. ...
Definition: symex_bmc.h:93
std::function< const goto_functionst::goto_functiont &(const irep_idt &)> get_goto_functiont
Definition: goto_symex.h:86
void add_loop_unwind_handler(loop_unwind_handlert handler)
Add a callback function that will be called to determine whether to unwind loops. ...
Definition: symex_bmc.h:62
void add_recursion_unwind_handler(recursion_unwind_handlert handler)
Add a callback function that will be called to determine whether to unwind recursion.
Definition: symex_bmc.h:71
bool output_coverage_report(const goto_functionst &goto_functions, const std::string &path) const
Definition: symex_bmc.h:76
symex_coveraget symex_coverage
Definition: symex_bmc.h:121
const symbol_tablet & outer_symbol_table
The symbol table associated with the goto-program that we&#39;re executing.
Definition: goto_symex.h:230
Symbolic Execution.
Definition: threeval.h:19
The symbol table.
Definition: symbol_table.h:19
path_storaget & path_storage
Definition: goto_symex.h:470
virtual void merge_goto(const statet::goto_statet &goto_state, statet &state)
Definition: symex_bmc.cpp:88
std::function< tvt(const goto_symex_statet::call_stackt &, unsigned, unsigned, unsigned &)> loop_unwind_handlert
Loop unwind handlers take the call stack, loop number, the unwind count so far, and an out-parameter ...
Definition: symex_bmc.h:47
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Definition: dstring.h:33
Loop unwinding.
Storage for symbolic execution paths to be resumed later.
Definition: path_storage.h:24
const optionst & options
Definition: goto_symex.h:204
The main class for the forward symbolic simulator.
Definition: goto_symex.h:48
std::vector< framet > call_stackt
virtual bool get_unwind_recursion(const irep_idt &identifier, const unsigned thread_nr, unsigned unwind)
Definition: symex_bmc.cpp:153
symex_bmct(message_handlert &mh, const symbol_tablet &outer_symbol_table, symex_target_equationt &_target, const optionst &options, path_storaget &path_storage)
Definition: symex_bmc.cpp:21
virtual void symex_step(const get_goto_functiont &get_goto_function, statet &state)
show progress
Definition: symex_bmc.cpp:34
source_locationt last_source_location
Definition: symex_bmc.h:36
Record and print code coverage of symbolic execution.
std::vector< loop_unwind_handlert > loop_unwind_handlers
Callbacks that may provide an unwind/do-not-unwind decision for a loop.
Definition: symex_bmc.h:89
std::function< tvt(const irep_idt &, unsigned, unsigned &)> recursion_unwind_handlert
Recursion unwind handlers take the function ID, the unwind count so far, and an out-parameter specify...
Definition: symex_bmc.h:56
Storage of symbolic execution paths to resume.
unwindsett unwindset
Definition: symex_bmc.h:85
virtual void no_body(const irep_idt &identifier)
Definition: symex_bmc.cpp:200