Skip to content

Commit

Permalink
fix: switch state
Browse files Browse the repository at this point in the history
Signed-off-by: hwk2077 <[email protected]>
  • Loading branch information
hwk2077 committed Oct 6, 2023
1 parent 790977b commit bb77459
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 116 deletions.
13 changes: 10 additions & 3 deletions libs2ecore/src/S2EExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,10 @@ void S2EExecutor::stateSwitchTimerCallback(void *opaque) {
void S2EExecutor::validPathSearcherStateSwitchCallback(void *opaque) {
S2EExecutor *c = (S2EExecutor *) opaque;

// assert(env->current_tb == nullptr);
assert(env->current_tb == nullptr);

if (g_s2e_state) {
// c->doLoadBalancing();
c->doLoadBalancing();
S2EExecutionState *nextState = c->selectNextState(g_s2e_state);
if (nextState) {
g_s2e_state = nextState;
Expand All @@ -830,9 +830,9 @@ void S2EExecutor::validPathSearcherStateSwitchCallback(void *opaque) {
return;
}
}
libcpu_mod_timer(c->m_stateSwitchTimer, libcpu_get_clock_ms(host_clock) + 100);
}


void S2EExecutor::initializeStateSwitchTimer() {
m_stateSwitchTimer = libcpu_new_timer_ms(host_clock, &stateSwitchTimerCallback, this);
libcpu_mod_timer(m_stateSwitchTimer, libcpu_get_clock_ms(host_clock) + 100);
Expand Down Expand Up @@ -1515,6 +1515,9 @@ S2EExecutor::StatePair S2EExecutor::fork(ExecutionState &current, const klee::re
currentState->forkDisabled = true;
}


g_s2e->getDebugStream() << "[dddcondition: " << condition << "] "
<< "\n";
res = Executor::fork(current, condition, conditionInCurrentState);

currentState->forkDisabled = oldForkStatus;
Expand Down Expand Up @@ -1928,7 +1931,11 @@ void S2EExecutor::setupTimersHandler() {
bool S2EExecutor::suspendState(S2EExecutionState *state) {
if (searcher) {
searcher->removeState(state, nullptr);
g_s2e->getDebugStream() << "[states' size " << getStatesCount() << "] "
<< "\n";
size_t r = states.erase(state);
g_s2e->getDebugStream() << "[states' size " << getStatesCount() << "] "
<< "\n";
assert(r == 1);
return true;
}
Expand Down
Loading

0 comments on commit bb77459

Please sign in to comment.