1 /* mc::remote::AppSide: the Application-side of the channel */
3 /* Copyright (c) 2015-2023. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #ifndef SIMGRID_MC_CLIENT_H
9 #define SIMGRID_MC_CLIENT_H
11 #include "src/mc/remote/Channel.hpp"
15 namespace simgrid::mc {
17 /** Model-checked-side of the communication protocol
19 * Send messages to the model-checker and handles message from it.
21 class XBT_PUBLIC AppSide {
24 static std::unique_ptr<AppSide> instance_;
28 explicit AppSide(int fd) : channel_(fd) {}
29 void handle_messages() const;
32 void handle_deadlock_check(const s_mc_message_t* msg) const;
33 void handle_simcall_execute(const s_mc_message_simcall_execute_t* message) const;
34 void handle_finalize(const s_mc_message_int_t* msg) const;
35 void handle_actors_status() const;
38 Channel const& get_channel() const { return channel_; }
39 Channel& get_channel() { return channel_; }
40 XBT_ATTRIB_NORETURN void main_loop() const;
41 void report_assertion_failure() const;
42 void ignore_memory(void* addr, std::size_t size) const;
43 void ignore_heap(void* addr, std::size_t size) const;
44 void unignore_heap(void* addr, std::size_t size) const;
45 void declare_symbol(const char* name, int* value) const;
47 void declare_stack(void* stack, size_t size, ucontext_t* context) const;
51 // TODO, remove the singleton antipattern.
52 static AppSide* initialize();
53 static AppSide* get() { return instance_.get(); }
55 } // namespace simgrid::mc