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 
83  const bool record_coverage;
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  void symex_step(const get_goto_functiont &get_goto_function, statet &state)
96  override;
97 
98  void
99  merge_goto(const statet::goto_statet &goto_state, statet &state) override;
100 
101  bool should_stop_unwind(
102  const symex_targett::sourcet &source,
103  const goto_symex_statet::call_stackt &context,
104  unsigned unwind) override;
105 
107  const irep_idt &identifier,
108  const unsigned thread_nr,
109  unsigned unwind) override;
110 
111  void no_body(const irep_idt &identifier) override;
112 
113  std::unordered_set<irep_idt> body_warnings;
114 
116 };
117 
118 #endif // CPROVER_CBMC_SYMEX_BMC_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:35
symex_coveraget
Definition: symex_coverage.h:28
symbol_tablet
The symbol table.
Definition: symbol_table.h:19
symex_bmct::loop_unwind_handlers
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
symex_bmct::recursion_unwind_handlert
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
symex_bmct::unwindset
unwindsett unwindset
Definition: symex_bmc.h:85
optionst
Definition: options.h:22
threeval.h
path_storaget
Storage for symbolic execution paths to be resumed later.
Definition: path_storage.h:24
goto_symext::path_storage
path_storaget & path_storage
Definition: goto_symex.h:427
goto_symex_statet
Definition: goto_symex_state.h:34
symex_bmct::merge_goto
void merge_goto(const statet::goto_statet &goto_state, statet &state) override
Definition: symex_bmc.cpp:89
symex_bmct::record_coverage
const bool record_coverage
Definition: symex_bmc.h:83
symex_bmct::body_warnings
std::unordered_set< irep_idt > body_warnings
Definition: symex_bmc.h:113
symex_bmct::add_loop_unwind_handler
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
path_storage.h
Storage of symbolic execution paths to resume.
symex_bmct::recursion_unwind_handlers
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
symex_bmct::get_unwind_recursion
bool get_unwind_recursion(const irep_idt &identifier, const unsigned thread_nr, unsigned unwind) override
Definition: symex_bmc.cpp:154
symex_bmct::output_coverage_report
bool output_coverage_report(const goto_functionst &goto_functions, const std::string &path) const
Definition: symex_bmc.h:76
goto_symext::outer_symbol_table
const symbol_tablet & outer_symbol_table
The symbol table associated with the goto-program that we're executing.
Definition: goto_symex.h:206
unwindsett
Definition: unwindset.h:21
symex_bmct::add_recursion_unwind_handler
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
symex_coverage.h
goto_symex.h
goto_symext
The main class for the forward symbolic simulator.
Definition: goto_symex.h:78
symex_coveraget::generate_report
bool generate_report(const goto_functionst &goto_functions, const std::string &path) const
Definition: symex_coverage.cpp:446
symex_bmct::should_stop_unwind
bool should_stop_unwind(const symex_targett::sourcet &source, const goto_symex_statet::call_stackt &context, unsigned unwind) override
Definition: symex_bmc.cpp:108
message_handlert
Definition: message.h:24
symex_bmct::symex_coverage
symex_coveraget symex_coverage
Definition: symex_bmc.h:115
symex_bmct::loop_unwind_handlert
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
goto_symex_statet::call_stackt
std::vector< framet > call_stackt
Definition: goto_symex_state.h:201
tvt
Definition: threeval.h:19
symex_target_equationt
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
Definition: symex_target_equation.h:35
source_locationt
Definition: source_location.h:20
goto_symex_statet::goto_statet
Definition: goto_symex_state.h:111
goto_functionst
A collection of goto functions.
Definition: goto_functions.h:22
symex_bmct::symex_step
void symex_step(const get_goto_functiont &get_goto_function, statet &state) override
show progress
Definition: symex_bmc.cpp:34
goto_symext::get_goto_functiont
std::function< const goto_functionst::goto_functiont &(const irep_idt &)> get_goto_functiont
Definition: goto_symex.h:109
symex_bmct
Definition: symex_bmc.h:25
symex_targett::sourcet
Identifies source in the context of symbolic execution.
Definition: symex_target.h:35
unwindset.h
symex_bmct::symex_bmct
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
message.h
symex_bmct::no_body
void no_body(const irep_idt &identifier) override
Definition: symex_bmc.cpp:201
symex_bmct::last_source_location
source_locationt last_source_location
Definition: symex_bmc.h:36