* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/ModelChecker.hpp"
-#include "src/mc/Session.hpp"
#include "src/mc/explo/Exploration.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_exit.hpp"
for (auto const& s : mc_model_checker->get_exploration()->get_textual_trace())
XBT_INFO(" %s", s.c_str());
XBT_INFO("Path = %s", mc_model_checker->get_exploration()->get_record_trace().to_string().c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
if (xbt_log_no_loc) {
XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
} else {
for (auto const& s : get_exploration()->get_textual_trace())
XBT_INFO(" %s", s.c_str());
XBT_INFO("Path = %s", get_exploration()->get_record_trace().to_string().c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
this->exit(SIMGRID_MC_EXIT_SAFETY);
throw DeadlockError();
}
}
-
-std::unique_ptr<simgrid::mc::Session> session_singleton;
}
}
bool actor_is_enabled(aid_t pid) const;
};
-
-// Temporary :)
-extern std::unique_ptr<simgrid::mc::Session> session_singleton;
}
}
return process_info;
}
-simgrid::mc::Exploration* Api::initialize(char** argv, simgrid::mc::CheckerAlgorithm algo) const
+simgrid::mc::Exploration* Api::initialize(char** argv, simgrid::mc::CheckerAlgorithm algo)
{
- simgrid::mc::session_singleton = std::make_unique<simgrid::mc::Session>([argv] {
+ session_ = std::make_unique<simgrid::mc::Session>([argv] {
int i = 1;
while (argv[i] != nullptr && argv[i][0] == '-')
i++;
simgrid::mc::Exploration* explo;
switch (algo) {
case CheckerAlgorithm::CommDeterminism:
- explo = simgrid::mc::create_communication_determinism_checker(session_singleton.get());
+ explo = simgrid::mc::create_communication_determinism_checker(session_.get());
break;
case CheckerAlgorithm::UDPOR:
- explo = simgrid::mc::create_udpor_checker(session_singleton.get());
+ explo = simgrid::mc::create_udpor_checker(session_.get());
break;
case CheckerAlgorithm::Safety:
- explo = simgrid::mc::create_safety_checker(session_singleton.get());
+ explo = simgrid::mc::create_safety_checker(session_.get());
break;
case CheckerAlgorithm::Liveness:
- explo = simgrid::mc::create_liveness_checker(session_singleton.get());
+ explo = simgrid::mc::create_liveness_checker(session_.get());
break;
default:
return snapshot;
}
-void Api::s_close() const
+void Api::s_close()
{
- session_singleton->close();
- session_singleton.reset();
+ session_.reset();
if (simgrid::mc::property_automaton != nullptr) {
xbt_automaton_free(simgrid::mc::property_automaton);
simgrid::mc::property_automaton = nullptr;
#include <vector>
#include "simgrid/forward.h"
+#include "src/mc/Session.hpp"
#include "src/mc/api/State.hpp"
#include "src/mc/mc_forward.hpp"
#include "src/mc/mc_record.hpp"
}
};
+ std::unique_ptr<simgrid::mc::Session> session_;
+
public:
// No copy:
Api(Api const&) = delete;
return api;
}
- simgrid::mc::Exploration* initialize(char** argv, simgrid::mc::CheckerAlgorithm algo) const;
+ simgrid::mc::Exploration* initialize(char** argv, simgrid::mc::CheckerAlgorithm algo);
// ACTOR APIs
std::vector<simgrid::mc::ActorInformation>& get_actors() const;
simgrid::mc::Snapshot* take_snapshot(long num_state) const;
// SESSION APIs
- void s_close() const;
+ simgrid::mc::Session const& get_session() { return *session_; }
+ void s_close();
-// AUTOMATION APIs
+ // AUTOMATION APIs
void automaton_load(const char* file) const;
std::vector<int> automaton_propositional_symbol_evaluate() const;
std::vector<xbt_automaton_state_t> get_automaton_state() const;
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/api/State.hpp"
-#include "src/mc/Session.hpp"
#include "src/mc/api.hpp"
#include "src/mc/mc_config.hpp"
const ActorState* actor_state = &actor_states_[aid];
/* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application*/
- if (not actor_state->is_todo() || not simgrid::mc::session_singleton->actor_is_enabled(aid))
+ if (not actor_state->is_todo() || not Api::get().get_session().actor_is_enabled(aid))
continue;
return i;
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/activity/MailboxImpl.hpp"
-#include "src/mc/Session.hpp"
#include "src/mc/explo/SafetyChecker.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_exit.hpp"
XBT_INFO("***** Non-send-deterministic communications pattern *****");
XBT_INFO("*********************************************************");
XBT_INFO("%s", send_diff.c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
Api::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
} else if (_sg_mc_comms_determinism && (not send_deterministic && not recv_deterministic)) {
XBT_INFO("****************************************************");
XBT_INFO("%s", send_diff.c_str());
if (not recv_diff.empty())
XBT_INFO("%s", recv_diff.c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
Api::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
}
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/explo/SafetyChecker.hpp"
-#include "src/mc/Session.hpp"
#include "src/mc/VisitedState.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_exit.hpp"
on_backtracking_signal();
stack_.pop_back();
- session_singleton->check_deadlock();
+ get_session().check_deadlock();
/* Traverse the stack backwards until a state with a non empty interleave set is found, deleting all the states that
* have it empty in the way. For each deleted state, check if the request that has generated it (from its