1 /* Copyright (c) 2007-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_MODEL_CHECKER_HPP
7 #define SIMGRID_MC_MODEL_CHECKER_HPP
9 #include "src/mc/sosp/PageStore.hpp"
16 #include <event2/event.h>
21 /** State of the model-checker (global variables for the model checker)
24 struct event_base *base_;
25 struct event* socket_event_;
26 struct event* signal_event_;
27 /** String pool for host names */
28 // TODO, use std::set with heterogeneous comparison lookup (C++14)?
29 std::set<std::string> hostnames_;
30 // This is the parent snapshot of the current state:
31 PageStore page_store_;
32 std::unique_ptr<RemoteClient> process_;
33 Checker* checker_ = nullptr;
36 ModelChecker(ModelChecker const&) = delete;
37 ModelChecker& operator=(ModelChecker const&) = delete;
38 explicit ModelChecker(std::unique_ptr<RemoteClient> process);
41 RemoteClient& process() { return *process_; }
42 PageStore& page_store()
47 std::string const& get_host_name(std::string const& hostname)
49 return *this->hostnames_.insert(hostname).first;
54 void resume(simgrid::mc::RemoteClient& process);
56 void handle_events(int fd, short events);
57 void wait_for_requests();
58 void handle_simcall(Transition const& transition);
59 XBT_ATTRIB_NORETURN void exit(int status);
63 Checker* getChecker() const { return checker_; }
64 void setChecker(Checker* checker) { checker_ = checker; }
68 bool handle_message(char* buffer, ssize_t size);
69 void handle_waitpid();
70 void on_signal(int signo);
73 unsigned long visited_states = 0;
74 unsigned long executed_transitions = 0;