Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set the textual representation of a transition before executing it
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 28 Feb 2021 23:38:00 +0000 (00:38 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 1 Mar 2021 00:17:51 +0000 (01:17 +0100)
This way it will correctly be set if the App aborts or fails during that execution.

Also, don't use the execution path that is reserved to simcalls with
observers `mc_model_checker->simcall_to_string()` in any case.
Prefer the path that works with old simcalls too `Api::request_to_string()`

src/mc/api.cpp
src/mc/api.hpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp

index 1bdd4a1..a7847e7 100644 (file)
@@ -1049,11 +1049,14 @@ void Api::restore_initial_state() const
   session->restore_initial_state();
 }
 
-void Api::execute(Transition const& transition) const
+void Api::execute(Transition& transition, smx_simcall_t simcall) const
 {
-  session->execute(transition);
-  auto textual = mc_model_checker->simcall_to_string(transition.pid_, transition.times_considered_);
+  /* FIXME: once all simcalls have observers, kill the simcall parameter and use mc_model_checker->simcall_to_string() */
+  auto textual =
+      simgrid::mc::Api::get().request_to_string(simcall, transition.times_considered_, RequestType::executed);
   strcpy((char*)transition.textual, textual.c_str());
+
+  session->execute(transition);
 }
 
 #if SIMGRID_HAVE_MC
index b2a5e8c..2252349 100644 (file)
@@ -136,7 +136,7 @@ public:
   // SESSION APIs
   void session_initialize() const;
   void s_close() const;
-  void execute(Transition const& transition) const;
+  void execute(Transition& transition, smx_simcall_t simcall) const;
 
 // AUTOMATION APIs
 #if SIMGRID_HAVE_MC
index 705ce85..41ddff8 100644 (file)
@@ -143,7 +143,7 @@ void LivenessChecker::replay()
       XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth,
                 api::get().request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str(), state.get());
 
-      api::get().execute(state->transition_);
+      api::get().execute(state->transition_, req);
     }
 
     /* Update statistics */
index c1d4620..6d06ac4 100644 (file)
@@ -131,7 +131,7 @@ void SafetyChecker::run()
     api::get().mc_inc_executed_trans();
 
     /* Actually answer the request: let execute the selected request (MCed does one step) */
-    api::get().execute(state->transition_);
+    api::get().execute(state->transition_, &state->executed_req_);
 
     /* Create the new expanded state (copy the state of MCed into our MCer data) */
     ++expanded_states_count_;
@@ -258,7 +258,7 @@ void SafetyChecker::restore_state()
   for (std::unique_ptr<State> const& state : stack_) {
     if (state == stack_.back())
       break;
-    api::get().execute(state->transition_);
+    api::get().execute(state->transition_, &state->executed_req_);
     /* Update statistics */
     api::get().mc_inc_visited_states();
     api::get().mc_inc_executed_trans();