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 handleMessages();
31 void handleDeadlockCheck(s_mc_message_t* msg);
32 void handleContinue(s_mc_message_t* msg);
33 void handleSimcall(s_mc_message_simcall_handle_t* message);
34 void handleRestore(s_mc_message_restore_t* msg);
35 void handleActorEnabled(s_mc_message_actor_enabled_t* msg);
38 Channel const& getChannel() const { return channel_; }
39 Channel& getChannel() { return channel_; }
41 void reportAssertionFailure();
42 void ignoreMemory(void* addr, std::size_t size);
43 void ignoreHeap(void* addr, std::size_t size);
44 void unignoreHeap(void* addr, std::size_t size);
45 void declareSymbol(const char* name, int* value);
47 void declareStack(void* stack, size_t size, smx_actor_t process, ucontext_t* context);
51 // TODO, remove the singleton antipattern.
52 static Client* initialize();
53 static Client* get() { return instance_.get(); }