X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=execution.cc;h=1bc648d464e52ae860c81103d7ed76f464209113;hp=c5c40a91f7776d43e98dd3cc027e8b9b05db56b0;hb=8e495e50d0a239f43fd000164e21da7964e51e54;hpb=54210d33af73ae7c74f2d416ab0e7bd472379e12 diff --git a/execution.cc b/execution.cc index c5c40a91..1bc648d4 100644 --- a/execution.cc +++ b/execution.cc @@ -27,6 +27,7 @@ struct model_snapshot_members { next_thread_id(INITIAL_THREAD_ID), used_sequence_numbers(0), bugs(), + dataraces(), bad_synchronization(false), asserted(false) { } @@ -34,12 +35,16 @@ struct model_snapshot_members { ~model_snapshot_members() { for (unsigned int i = 0;i < bugs.size();i++) delete bugs[i]; + for (unsigned int i = 0;i < dataraces.size(); i++) + delete dataraces[i]; bugs.clear(); + dataraces.clear(); } unsigned int next_thread_id; modelclock_t used_sequence_numbers; SnapVector bugs; + SnapVector dataraces; /** @brief Incorrectly-ordered synchronization was made */ bool bad_synchronization; bool asserted; @@ -185,12 +190,38 @@ bool ModelExecution::assert_bug(const char *msg) return false; } +/* @brief Put data races in a different list from other bugs. The purpose + * is to continue the program untill the number of data races exceeds a + * threshold */ + +/* TODO: check whether set_assert should be called */ +bool ModelExecution::assert_race(const char *msg) +{ + priv->dataraces.push_back(new bug_message(msg)); + + if (isfeasibleprefix()) { + set_assert(); + return true; + } + return false; +} + /** @return True, if any bugs have been reported for this execution */ bool ModelExecution::have_bug_reports() const { return priv->bugs.size() != 0; } +/** @return True, if any fatal bugs have been reported for this execution. + * Any bug other than a data race is considered a fatal bug. Data races + * are not considered fatal unless the number of races is exceeds + * a threshold (temporarily set as 15). + */ +bool ModelExecution::have_fatal_bug_reports() const +{ + return priv->bugs.size() != 0 || priv->dataraces.size() >= 15; +} + SnapVector * ModelExecution::get_bugs() const { return &priv->bugs; @@ -1538,8 +1569,8 @@ Thread * ModelExecution::take_step(ModelAction *curr) curr = check_current_action(curr); ASSERT(curr); - // model_print("poitner loc: %p, thread: %d, type: %d, order: %d, position: %s\n", curr, curr->get_tid(), curr->get_type(), curr->get_mo(), curr->get_position() ); - model->get_history()->add_func_atomic( curr, curr_thrd->get_id() ); + /* Process this action in ModelHistory for records*/ + model->get_history()->process_action( curr, curr_thrd->get_id() ); if (curr_thrd->is_blocked() || curr_thrd->is_complete()) scheduler->remove_thread(curr_thrd);