Example #1
0
goto_symext::symex_resultt *
reachability_treet::generate_schedule_formula()
{

  int total_states = 0;
  while (has_more_states())
  {
    total_states++;
    while ((!get_cur_state().has_cswitch_point_occured() ||
           get_cur_state().check_if_ileaves_blocked()) &&
           get_cur_state().can_execution_continue())
    {
      get_cur_state().symex_step(*this);
    }

    if (state_hashing) {
      if (check_for_hash_collision()) {
        post_hash_collision_cleanup();
        go_next_state();
        continue;
      } else {
        update_hash_collision_set();
      }
    }

    next_thread_id = decide_ileave_direction(get_cur_state());

    create_next_state();

    go_next_state();
  }

  return new goto_symext::symex_resultt(schedule_target, schedule_total_claims,
                                        schedule_remaining_claims);
}
bool
reachability_treet::step_next_state(void)
{

  next_thread_id = decide_ileave_direction(get_cur_state());
  if (next_thread_id != get_cur_state().threads_state.size()) {
    create_next_state();
    return true;
  }

  return false;
}
std::shared_ptr<goto_symext::symex_resultt>
reachability_treet::get_next_formula()
{

  assert(execution_states.size() > 0 && "Must setup RT before exploring");

  while(!is_has_complete_formula())
  {
    while ((!get_cur_state().has_cswitch_point_occured() ||
           get_cur_state().check_if_ileaves_blocked()) &&
           get_cur_state().can_execution_continue())
      get_cur_state().symex_step(*this);

    if (state_hashing) {
      if (check_for_hash_collision()) {
        post_hash_collision_cleanup();
        break;
      } else {
        update_hash_collision_set();
      }
    }

    if (por) {
      get_cur_state().calculate_mpor_constraints();
      if (get_cur_state().is_transition_blocked_by_mpor())
        break;
    }


    next_thread_id = decide_ileave_direction(get_cur_state());

    create_next_state();

    switch_to_next_execution_state();

    if (get_cur_state().interleaving_unviable)
      break;
  }

  (*cur_state_it)->finish_formula();

  has_complete_formula = false;

  return get_cur_state().get_symex_result();
}