示例#1
0
void reachability_treet::go_next_state()
{

  std::list<std::shared_ptr<execution_statet>>::iterator it = cur_state_it;
  it++;
  if(it != execution_states.end())
    cur_state_it++;
  else
  {
    while(execution_states.size() > 0 && !step_next_state())
    {
      it = cur_state_it;
      cur_state_it--;

      // For the last one:
      if (execution_states.size() == 1)
        (*it)->finish_formula();

      execution_states.erase(it);
    }

    if(execution_states.size() > 0)
      cur_state_it++;
  }
}
示例#2
0
void reachability_treet::switch_to_next_execution_state()
{

  std::list<std::shared_ptr<execution_statet> >::iterator it = cur_state_it;
  it++;

  if(it != execution_states.end()) {
    cur_state_it++;
  } else {
    if (step_next_state()) {
      cur_state_it++;
    } else {
      if (config.options.get_bool_option("print-stack-traces"))
        print_ileave_trace();
      has_complete_formula = true;
    }
  }
}
示例#3
0
bool reachability_treet::reset_to_unexplored_state()
{
  std::list<execution_statet*>::iterator it;

  // After executing up to a point where all threads have ended and returning
  // that equation to the caller, free and remove fully explored execution
  // states back to the point where there's an unexplored one.

  // Eliminate final execution state, then attempt to generate another one from
  // the last on the list. If we can, it's an unexplored state, if we can't,
  // all depths from the current execution state are explored, so delete it.

  it = cur_state_it--;
  delete *it;
  execution_states.erase(it);

  while(execution_states.size() > 0 && !step_next_state()) {
    it = cur_state_it--;
    delete *it;
    execution_states.erase(it);
  }

  if (execution_states.size() > 0)
    cur_state_it++;

  if (execution_states.size() != 0) {
    // When backtracking, erase all the assertions from the equation before
    // continuing forwards. They've all already been checked, in the trace we
    // just backtracked from. Thus there's no point in checking them again.
    symex_target_equationt *eq =
      static_cast<symex_target_equationt*>((*cur_state_it)->target);
    unsigned int num_asserts = eq->clear_assertions();

    // Remove them from the count of remaining assertions to check. This allows
    // for more traces to be discarded because they do not contain any
    // unchecked assertions.
    (*cur_state_it)->total_claims -= num_asserts;
    (*cur_state_it)->remaining_claims -= num_asserts;
  }

  return execution_states.size() != 0;
}