Go to the documentation of this file.
16 : log(message_handler)
26 "symex-complexity-failed-child-loops-limit");
34 if(failed_child_loops_limit > 0)
46 for(
auto frame_iter = current_call_stack.rbegin();
47 frame_iter != current_call_stack.rend();
52 if(!frame_iter->active_loops.empty())
54 return &frame_iter->active_loops.back();
65 for(
auto frame_iter = current_call_stack.rbegin();
66 frame_iter != current_call_stack.rend();
69 for(
auto &loop_iter : frame_iter->active_loops)
71 for(
auto &blacklisted_loop : loop_iter.blacklisted_loops)
73 if(blacklisted_loop.get().contains(instr))
87 std::size_t sum_complexity = 0;
102 for(
auto frame_iter = current_call_stack.rbegin();
103 frame_iter != current_call_stack.rend();
106 for(
auto it = frame_iter->active_loops.rbegin();
107 it != frame_iter->active_loops.rend();
110 auto &loop_info = *it;
115 if(loop_to_blacklist)
117 loop_info.blacklisted_loops.emplace_back(*loop_to_blacklist);
121 sum_complexity += loop_info.children_too_complex;
124 loop_to_blacklist = &loop_info.loop;
130 return !loop_to_blacklist;
139 std::size_t complexity =
144 auto ¤t_call_stack = state.
call_stack();
152 if(active_loop !=
nullptr)
154 active_loop->children_too_complex++;
160 <<
"[symex-complexity] Loop operations considered too complex"
161 << (state.
source.
pc->source_location().is_not_nil()
162 ?
" at: " + state.
source.
pc->source_location().as_string()
163 :
", location number: " +
171 log.
warning() <<
"[symex-complexity] Branch considered too complex"
172 << (state.
source.
pc->source_location().is_not_nil()
174 state.
source.
pc->source_location().as_string()
175 :
", location number: " +
192 log.
warning() <<
"[symex-complexity] Trying to enter blacklisted loop"
193 << (state.
source.
pc->source_location().is_not_nil()
195 state.
source.
pc->source_location().as_string()
196 :
", location number: " +
215 transform_lambda.transform(complexity_violation, current_state);
227 for(
const auto &op : ops)
static std::size_t bounded_expr_size(const exprt &expr, std::size_t limit)
Amount of nodes in expr approximately bounded by limit.
bool complexity_active
Is the complexity module active, usually coincides with a max_complexity value above 0.
bool complexity_limits_active()
Is the complexity module active?
bool reachable
Is this code reachable? If not we can take shortcuts such as not entering function calls,...
goto_programt::const_targett pc
std::vector< symex_complexity_limit_exceeded_actiont > violation_transformations
Functions called when the heuristic has been violated.
Central data structure: state.
std::size_t max_complexity
The max complexity rating that a branch can be before it's abandoned.
Base class for all expressions.
complexity_violationt
What sort of symex-complexity violation has taken place.
symex_targett::sourcet source
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
call_stackt & call_stack()
complexity_limitert()=default
void run_transformations(complexity_violationt complexity_violation, goto_symex_statet ¤t_state)
Runs a suite of transformations on the state and symex executable, performing whatever transformation...
A loop, specified as a set of instructions.
signed int get_signed_int_option(const std::string &option) const
virtual void transform(const complexity_violationt heuristic_result, goto_symex_statet ¤t_state)
static std::size_t bounded_expr_size(const exprt &expr, std::size_t count, std::size_t limit)
Amount of nodes expr contains, with a bound on how far to search.
std::size_t max_loops_complexity
The amount of branches that can fail within the scope of a loops execution before the entire loop is ...
bool are_loop_children_too_complicated(call_stackt ¤t_call_stack)
Checks whether the current loop execution stack has violated max_loops_complexity.
instructionst::const_iterator const_targett
static framet::active_loop_infot * get_current_active_loop(call_stackt ¤t_call_stack)
Returns inner-most currently active loop.
symex_complexity_limit_exceeded_actiont default_transformation
Default heuristic transformation. Sets state as unreachable.
complexity_violationt check_complexity(goto_symex_statet &state)
Checks the passed-in state to see if its become too complex for us to deal with, and if so set its gu...
static bool in_blacklisted_loop(const call_stackt ¤t_call_stack, const goto_programt::const_targett &instr)
Checks whether we're in a loop that is currently considered blacklisted, and shouldn't be executed.
mstreamt & warning() const