Checks for mid-execution assertions should occur before take_step().
This can catch a mid-step bug (e.g., data race or user-assertion) that
happens between ModelAction steps.
*/
Thread * ModelChecker::take_step(ModelAction *curr)
{
- if (has_asserted())
- return NULL;
-
Thread *curr_thrd = get_thread(curr);
ASSERT(curr_thrd->get_state() == THREAD_READY);
scheduler->next_thread(t);
Thread::swap(&system_context, t);
+ /* Catch assertions from prior take_step or from
+ * between-ModelAction bugs (e.g., data races) */
+ if (has_asserted())
+ break;
+
/* Consume the next action for a Thread */
ModelAction *curr = t->get_pending();
t->set_pending(NULL);