X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9e8ba3861df85d86342342252be58cd546df2d08..3086f8693ca7977af2f666bca46f733046b22996:/src/mc/SafetyChecker.cpp diff --git a/src/mc/SafetyChecker.cpp b/src/mc/SafetyChecker.cpp index 664379d2fd..0ff20dfcb3 100644 --- a/src/mc/SafetyChecker.cpp +++ b/src/mc/SafetyChecker.cpp @@ -25,6 +25,7 @@ #include "src/mc/Checker.hpp" #include "src/mc/SafetyChecker.hpp" #include "src/mc/VisitedState.hpp" +#include "src/mc/Transition.hpp" #include "src/xbt/mmalloc/mmprivate.h" @@ -76,7 +77,7 @@ std::vector SafetyChecker::getTextualTrace() // override { std::vector trace; for (auto const& state : stack_) { - int value = state->req_num; + int value = state->transition.argument; smx_simcall_t req = &state->executed_req; if (req) trace.push_back(simgrid::mc::request_to_string( @@ -89,8 +90,6 @@ int SafetyChecker::run() { this->init(); - int value; - while (!stack_.empty()) { /* Get current state */ @@ -108,7 +107,7 @@ int SafetyChecker::run() // let's back-track. smx_simcall_t req = nullptr; if (stack_.size() > (std::size_t) _sg_mc_max_depth - || (req = MC_state_get_request(state, &value)) == nullptr + || (req = MC_state_get_request(state)) == nullptr || visitedState_ != nullptr) { int res = this->backtrack(); if (res) @@ -117,23 +116,25 @@ int SafetyChecker::run() continue; } + int req_num = state->transition.argument; + // If there are processes to interleave and the maximum depth has not been // reached then perform one step of the exploration algorithm. XBT_DEBUG("Execute: %s", simgrid::mc::request_to_string( - req, value, simgrid::mc::RequestType::simix).c_str()); + req, req_num, simgrid::mc::RequestType::simix).c_str()); std::string req_str; if (dot_output != nullptr) - req_str = simgrid::mc::request_get_dot_output(req, value); + req_str = simgrid::mc::request_get_dot_output(req, req_num); mc_stats->executed_transitions++; // TODO, bundle both operations in a single message - // MC_execute_transition(req, value) + // MC_execute_transition(req, req_num) /* Answer the request */ - simgrid::mc::handle_simcall(req, value); + mc_model_checker->handle_simcall(state->transition); mc_model_checker->wait_for_requests(); /* Create the new expanded state */ @@ -220,13 +221,13 @@ int SafetyChecker::backtrack() && simgrid::mc::request_depend(req, &prev_state->internal_req)) { if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) { XBT_DEBUG("Dependent Transitions:"); - int value = prev_state->req_num; + int value = prev_state->transition.argument; smx_simcall_t prev_req = &prev_state->executed_req; XBT_DEBUG("%s (state=%d)", simgrid::mc::request_to_string( prev_req, value, simgrid::mc::RequestType::internal).c_str(), prev_state->num); - value = state->req_num; + value = state->transition.argument; prev_req = &state->executed_req; XBT_DEBUG("%s (state=%d)", simgrid::mc::request_to_string(