1 /* Copyright (c) 2016-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_MC_SESSION_HPP
7 #define SIMGRID_MC_SESSION_HPP
9 #include "src/mc/ModelChecker.hpp"
16 /** A model-checking session
18 * This is expected to become the interface used by model-checking
19 * algorithms to control the execution of the model-checked process
20 * and the exploration of the execution graph. Model-checking
21 * algorithms should be able to be written in high-level languages
22 * (e.g. Python) using bindings on this interface.
24 class XBT_PUBLIC Session {
26 std::unique_ptr<ModelChecker> model_checker_;
27 std::shared_ptr<simgrid::mc::Snapshot> initial_snapshot_;
30 Session(Session const&) = delete;
31 Session& operator=(Session const&) = delete;
34 /** Create a new session by executing the provided code in a fork()
36 * This sets up the environment for the model-checked process
37 * (environment variables, sockets, etc.).
39 * The code is expected to `exec` the model-checked application.
41 explicit Session(const std::function<void()>& code);
47 void execute(Transition const& transition);
50 void restore_initial_state();
54 extern simgrid::mc::Session* session;