Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make a global singleton of Exploration, to kill ModelChecker
[simgrid.git] / src / mc / api / RemoteApp.cpp
index 813a482..dd249a2 100644 (file)
@@ -125,10 +125,10 @@ RemoteApp::RemoteApp(const std::vector<char*>& args)
 
   xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?");
 
-  checker_side_  = std::make_unique<simgrid::mc::CheckerSide>(sockets[1]);
   auto memory      = std::make_unique<simgrid::mc::RemoteProcessMemory>(pid);
   model_checker_   = std::make_unique<simgrid::mc::ModelChecker>(std::move(memory));
   mc_model_checker = model_checker_.get();
+  checker_side_    = std::make_unique<simgrid::mc::CheckerSide>(sockets[1], model_checker_.get());
 
   start();
 
@@ -149,8 +149,6 @@ RemoteApp::~RemoteApp()
 }
 void RemoteApp::start()
 {
-  checker_side_->start(model_checker_.get());
-
   XBT_DEBUG("Waiting for the model-checked process");
   int status;
 
@@ -284,13 +282,14 @@ void RemoteApp::check_deadlock() const
              to_c_str(message.type), (int)message.type, (int)MessageType::DEADLOCK_CHECK_REPLY);
 
   if (message.value != 0) {
+    auto* explo = Exploration::get_instance();
     XBT_CINFO(mc_global, "Counter-example execution trace:");
-    for (auto const& frame : model_checker_->get_exploration()->get_textual_trace())
+    for (auto const& frame : explo->get_textual_trace())
       XBT_CINFO(mc_global, "  %s", frame.c_str());
     XBT_INFO("You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with "
              "--cfg=model-check/replay:'%s'",
-             model_checker_->get_exploration()->get_record_trace().to_string().c_str());
-    model_checker_->get_exploration()->log_state();
+             explo->get_record_trace().to_string().c_str());
+    explo->log_state();
     throw DeadlockError();
   }
 }
@@ -303,7 +302,7 @@ void RemoteApp::wait_for_requests()
   get_remote_process_memory().clear_cache();
 
   if (this->get_remote_process_memory().running())
-    checker_side_->dispatch();
+    checker_side_->dispatch_events();
 }
 
 void RemoteApp::shutdown()
@@ -329,7 +328,7 @@ Transition* RemoteApp::handle_simcall(aid_t aid, int times_considered, bool new_
 
   get_remote_process_memory().clear_cache();
   if (this->get_remote_process_memory().running())
-    checker_side_->dispatch(); // The app may send messages while processing the transition
+    checker_side_->dispatch_events(); // 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);