Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC_replay: Ensure that times_considered is always set
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 30 Oct 2022 23:27:14 +0000 (00:27 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 30 Oct 2022 23:27:18 +0000 (00:27 +0100)
+ small cosmetics while reading again that code

src/kernel/actor/SynchroObserver.hpp
src/mc/mc_base.cpp
src/mc/mc_record.cpp

index c953c5d..2c2eac3 100644 (file)
@@ -58,7 +58,7 @@ public:
   double get_timeout() const { return timeout_; }
 };
 
-/* This observer is ued for BARRIER_LOCK and BARRIER_WAIT. WAIT is returning and needs the acquisition */
+/* This observer is used for BARRIER_LOCK and BARRIER_WAIT. WAIT is returning and needs the acquisition */
 class BarrierObserver final : public ResultingSimcall<bool> {
   mc::Transition::Type type_;
   activity::BarrierImpl* const barrier_                = nullptr;
index 781a5ee..e9d6db6 100644 (file)
@@ -75,10 +75,9 @@ bool request_is_visible(const kernel::actor::Simcall* req)
 #if SIMGRID_HAVE_MC
   xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
 #endif
-  if (req->observer_ != nullptr)
-    return req->observer_->is_visible();
-  else
+  if (req->observer_ == nullptr)
     return false;
+  return req->observer_->is_visible();
 }
 
 } // namespace simgrid::mc
index 72483fe..18f8ec9 100644 (file)
@@ -31,8 +31,10 @@ void RecordTrace::replay() const
     kernel::actor::ActorImpl* actor = kernel::EngineImpl::get_instance()->get_actor_by_pid(transition->aid_);
     xbt_assert(actor != nullptr, "Unexpected actor (id:%ld).", transition->aid_);
     const kernel::actor::Simcall* simcall = &(actor->simcall_);
-    xbt_assert(simcall->call_ != kernel::actor::Simcall::Type::NONE, "No simcall for process %ld.", transition->aid_);
-    xbt_assert(simgrid::mc::request_is_visible(simcall) && simgrid::mc::actor_is_enabled(actor), "Unexpected simcall.");
+    xbt_assert(simgrid::mc::request_is_visible(simcall), "Simcall %s of actor %s is not visible.", simcall->get_cname(),
+               actor->get_cname());
+    xbt_assert(simgrid::mc::actor_is_enabled(actor), "Actor %s (simcall %s) is not enabled.", actor->get_cname(),
+               simcall->get_cname());
 
     // Execute the request:
     simcall->issuer_->simcall_handle(transition->times_considered_);
@@ -59,7 +61,7 @@ simgrid::mc::RecordTrace::RecordTrace(const char* data)
   const char* current = data;
   while (*current) {
     long aid;
-    int times_considered;
+    int times_considered = 0;
 
     if (int count = sscanf(current, "%ld/%d", &aid, &times_considered); count != 2 && count != 1)
       throw std::invalid_argument("Could not parse record path");