1 /* Copyright (c) 2007-2020. 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_MODEL_CHECKER_HPP
7 #define SIMGRID_MC_MODEL_CHECKER_HPP
9 #include "src/mc/remote/CheckerSide.hpp"
10 #include "src/mc/sosp/PageStore.hpp"
20 /** State of the model-checker (global variables for the model checker)
23 CheckerSide event_loop_;
24 /** String pool for host names */
25 std::set<std::string> hostnames_;
26 // This is the parent snapshot of the current state:
27 PageStore page_store_{500};
28 std::unique_ptr<RemoteClient> process_;
29 Checker* checker_ = nullptr;
32 ModelChecker(ModelChecker const&) = delete;
33 ModelChecker& operator=(ModelChecker const&) = delete;
34 explicit ModelChecker(std::unique_ptr<RemoteClient> process);
36 RemoteClient& process() { return *process_; }
37 PageStore& page_store()
42 std::string const& get_host_name(std::string const& hostname)
44 return *this->hostnames_.insert(hostname).first;
49 void resume(simgrid::mc::RemoteClient& process);
50 void handle_events(int fd, short events);
51 void wait_for_requests();
52 void handle_simcall(Transition const& transition);
54 XBT_ATTRIB_NORETURN void exit(int status);
58 Checker* getChecker() const { return checker_; }
59 void setChecker(Checker* checker) { checker_ = checker; }
63 bool handle_message(const char* buffer, ssize_t size);
64 void handle_waitpid();
67 unsigned long visited_states = 0;
68 unsigned long executed_transitions = 0;