void model_assert(bool expr, const char *file, int line)
{
if (!expr) {
- printf(" [BUG] Program has hit assertion in file %s at line %d\n",
+ char msg[100];
+ sprintf(msg, "Program has hit assertion in file %s at line %d\n",
file, line);
- model->set_assert();
- model->switch_to_master(NULL);
+ model->assert_bug(msg, true);
}
}
unrealizedraces.push_back(race);
/* If the race is realized, bail out now. */
- if (checkDataRaces()) {
- model->set_assert();
- model->switch_to_master(NULL);
- }
+ if (checkDataRaces())
+ model->assert_bug("Datarace", true);
}
/** This function goes through the list of unrealized data races,
num_feasible_executions++;
if (is_deadlocked())
- assert_bug("Deadlock detected", false);
+ assert_bug("Deadlock detected");
print_bugs();
checkDataRaces();
}
//otherwise fall into the lock case
case ATOMIC_LOCK: {
- if (curr->get_cv()->getClock(state->alloc_tid) <= state->alloc_clock) {
- printf("Lock access before initialization\n");
- set_assert();
- }
+ if (curr->get_cv()->getClock(state->alloc_tid) <= state->alloc_clock)
+ assert_bug("Lock access before initialization");
state->islocked = true;
ModelAction *unlock = get_last_unlock(curr);
//synchronize with the previous unlock statement
/* See if we have realized a data race */
if (checkDataRaces())
- set_assert();
+ assert_bug("Datarace");
}
/**
}
// If we resolved promises or data races, see if we have realized a data race.
- if (checkDataRaces()) {
- set_assert();
- }
+ if (checkDataRaces())
+ assert_bug("Datarace");
return updated;
}