X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e8b892d82b85cf919ae6afe05617ea74e4e0cfbf..934f086b51d328c46cb8fb20db2ad3efd4668ac9:/src/mc/ModelChecker.cpp diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index a753c9d3fa..9dbc7412bf 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -5,8 +5,8 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/Session.hpp" -#include "src/mc/Transition.hpp" -#include "src/mc/TransitionComm.hpp" +#include "src/mc/api/Transition.hpp" +#include "src/mc/api/TransitionComm.hpp" #include "src/mc/checker/Checker.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/mc_exit.hpp" @@ -139,7 +139,7 @@ static void MC_report_crash(int status) XBT_INFO("Counter-example execution trace:"); for (auto const& s : mc_model_checker->getChecker()->get_textual_trace()) XBT_INFO(" %s", s.c_str()); - dumpRecordPath(); + XBT_INFO("Path = %s", mc_model_checker->getChecker()->get_record_trace().to_string().c_str()); session_singleton->log_state(); if (xbt_log_no_loc) { XBT_INFO("Stack trace not displayed because you passed --log=no_loc"); @@ -230,7 +230,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) XBT_INFO("Counter-example execution trace:"); for (auto const& s : getChecker()->get_textual_trace()) XBT_INFO(" %s", s.c_str()); - dumpRecordPath(); + XBT_INFO("Path = %s", getChecker()->get_record_trace().to_string().c_str()); session_singleton->log_state(); this->exit(SIMGRID_MC_EXIT_SAFETY); @@ -309,15 +309,19 @@ void ModelChecker::wait_for_requests() checker_side_.dispatch(); } -Transition* ModelChecker::handle_simcall(Transition const& transition, bool new_transition) +Transition* ModelChecker::handle_simcall(aid_t aid, int times_considered, bool new_transition) { s_mc_message_simcall_execute_t m; memset(&m, 0, sizeof(m)); m.type = MessageType::SIMCALL_EXECUTE; - m.aid_ = transition.aid_; - m.times_considered_ = transition.times_considered_; + m.aid_ = aid; + m.times_considered_ = times_considered; checker_side_.get_channel().send(m); + this->remote_process_->clear_cache(); + if (this->remote_process_->running()) + checker_side_.dispatch(); // The app may send messages while processing the transition + s_mc_message_simcall_execute_answer_t answer; ssize_t s = checker_side_.get_channel().receive(answer); xbt_assert(s != -1, "Could not receive message"); @@ -327,13 +331,10 @@ Transition* ModelChecker::handle_simcall(Transition const& transition, bool new_ to_c_str(answer.type), (int)answer.type, (int)s, (int)MessageType::SIMCALL_EXECUTE_ANSWER, (int)sizeof(answer)); - this->remote_process_->clear_cache(); - if (this->remote_process_->running()) - checker_side_.dispatch(); // The app may send messages while processing the transition - - if (new_transition) - return recv_transition(transition.aid_, transition.times_considered_, answer.simcall, answer.buffer); - else + if (new_transition) { + std::stringstream stream(answer.buffer.data()); + return deserialize_transition(aid, times_considered, stream); + } else return nullptr; } bool ModelChecker::simcall_is_visible(aid_t aid) @@ -361,30 +362,6 @@ bool ModelChecker::simcall_is_visible(aid_t aid) return answer.value; } -std::string ModelChecker::simcall_dot_label(aid_t aid, int times_considered) -{ - xbt_assert(mc_model_checker != nullptr, "This should be called from the checker side"); - - s_mc_message_simcall_to_string_t m; - memset(&m, 0, sizeof(m)); - m.type = MessageType::SIMCALL_DOT_LABEL; - m.aid = aid; - m.time_considered = times_considered; - checker_side_.get_channel().send(m); - - s_mc_message_simcall_to_string_answer_t answer; - ssize_t s = checker_side_.get_channel().receive(answer); - xbt_assert(s != -1, "Could not receive message"); - xbt_assert(s == sizeof(answer) && answer.type == MessageType::SIMCALL_DOT_LABEL_ANSWER, - "Received unexpected message %s (%i, size=%i) " - "expected MessageType::SIMCALL_TO_STRING_ANSWER (%i, size=%i)", - to_c_str(answer.type), (int)answer.type, (int)s, (int)MessageType::SIMCALL_DOT_LABEL_ANSWER, - (int)sizeof(answer)); - - XBT_DEBUG("dot_label(%ld) is returning %s", aid, answer.value); - return answer.value; -} - void ModelChecker::finalize_app(bool terminate_asap) { s_mc_message_int_t m;