From: Martin Quinson Date: Sun, 30 Oct 2022 23:27:14 +0000 (+0100) Subject: MC_replay: Ensure that times_considered is always set X-Git-Tag: v3.34~725 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/52eb02f7eb2f3fb537b0b8f7f8e40ae89a83d4c6 MC_replay: Ensure that times_considered is always set + small cosmetics while reading again that code --- diff --git a/src/kernel/actor/SynchroObserver.hpp b/src/kernel/actor/SynchroObserver.hpp index c953c5d20d..2c2eac378a 100644 --- a/src/kernel/actor/SynchroObserver.hpp +++ b/src/kernel/actor/SynchroObserver.hpp @@ -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 { mc::Transition::Type type_; activity::BarrierImpl* const barrier_ = nullptr; diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 781a5ee262..e9d6db6c64 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -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 diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index 72483fe420..18f8ec91b1 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -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, ×_considered); count != 2 && count != 1) throw std::invalid_argument("Could not parse record path");