1 /* Copyright (c) 2015-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_CLIENT_H
7 #define SIMGRID_MC_CLIENT_H
9 #include "src/mc/remote/Channel.hpp"
16 /** Model-checked-side of the communication protocol
18 * Send messages to the model-checker and handles message from it.
20 class XBT_PUBLIC Client {
23 static std::unique_ptr<Client> instance_;
27 explicit Client(int fd) : channel_(fd) {}
28 void handle_messages();
31 void handle_deadlock_check(s_mc_message_t* msg);
32 void handle_continue(s_mc_message_t* msg);
33 void handle_simcall(s_mc_message_simcall_handle_t* message);
34 void handle_actor_enabled(s_mc_message_actor_enabled_t* msg);
37 Channel const& get_channel() const { return channel_; }
38 Channel& get_channel() { return channel_; }
39 XBT_ATTRIB_NORETURN void main_loop();
40 void report_assertion_failure();
41 void ignore_memory(void* addr, std::size_t size);
42 void ignore_heap(void* addr, std::size_t size);
43 void unignore_heap(void* addr, std::size_t size);
44 void declare_symbol(const char* name, int* value);
46 void declare_stack(void* stack, size_t size, ucontext_t* context);
50 // TODO, remove the singleton antipattern.
51 static Client* initialize();
52 static Client* get() { return instance_.get(); }