X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/63c371bbca5afccc4708761d83af6fc2443ca553..7d5154294d0c97a3690134cc5d3a9900189055cf:/src/mc/remote/Client.hpp diff --git a/src/mc/remote/Client.hpp b/src/mc/remote/Client.hpp index ead07fe129..b26207ed80 100644 --- a/src/mc/remote/Client.hpp +++ b/src/mc/remote/Client.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2015-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -7,18 +6,10 @@ #ifndef SIMGRID_MC_CLIENT_H #define SIMGRID_MC_CLIENT_H -#include "src/internal_config.h" +#include "src/mc/remote/Channel.hpp" -#include #include -#include - -#include - -#include "src/mc/remote/Channel.hpp" -#include "src/mc/remote/mc_protocol.h" - namespace simgrid { namespace mc { @@ -26,42 +17,41 @@ namespace mc { * * Send messages to the model-checker and handles message from it. */ -class XBT_PUBLIC() Client { +class XBT_PUBLIC Client { private: - bool active_ = false; Channel channel_; - static std::unique_ptr client_; + static std::unique_ptr instance_; public: Client(); - explicit Client(int fd) : active_(true), channel_(fd) {} - void handleMessages(); - Channel const& getChannel() const { return channel_; } - Channel& getChannel() { return channel_; } - void mainLoop(); - void reportAssertionFailure(const char* description = nullptr); - void ignoreMemory(void* addr, std::size_t size); - void ignoreHeap(void* addr, std::size_t size); - void unignoreHeap(void* addr, std::size_t size); - void declareSymbol(const char* name, int* value); + explicit Client(int fd) : channel_(fd) {} + void handle_messages(); + +private: + void handle_deadlock_check(s_mc_message_t* msg); + void handle_continue(s_mc_message_t* msg); + void handle_simcall(s_mc_message_simcall_handle_t* message); + void handle_actor_enabled(s_mc_message_actor_enabled_t* msg); + +public: + Channel const& get_channel() const { return channel_; } + Channel& get_channel() { return channel_; } + XBT_ATTRIB_NORETURN void main_loop(); + void report_assertion_failure(); + void ignore_memory(void* addr, std::size_t size); + void ignore_heap(void* addr, std::size_t size); + void unignore_heap(void* addr, std::size_t size); + void declare_symbol(const char* name, int* value); #if HAVE_UCONTEXT_H - void declareStack(void* stack, size_t size, smx_actor_t process, ucontext_t* context); + void declare_stack(void* stack, size_t size, ucontext_t* context); #endif // Singleton :/ // TODO, remove the singleton antipattern. static Client* initialize(); - static Client* get() { return client_.get(); } + static Client* get() { return instance_.get(); } }; } } -SG_BEGIN_DECL() - -#if HAVE_MC -void MC_ignore(void* addr, std::size_t size); -#endif - -SG_END_DECL() - #endif