X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c4da7e409e2f6d39b72ea32f61d04da85a126a28..50753d5f8442a47c17c4035724201a18a7ff6146:/src/mc/remote/CheckerSide.hpp diff --git a/src/mc/remote/CheckerSide.hpp b/src/mc/remote/CheckerSide.hpp index 0c3294885c..17fb33c3c4 100644 --- a/src/mc/remote/CheckerSide.hpp +++ b/src/mc/remote/CheckerSide.hpp @@ -15,27 +15,48 @@ namespace simgrid::mc { +/* CheckerSide: All what the checker needs to interact with a given application process */ + class CheckerSide { + event* socket_event_; + event* signal_event_; std::unique_ptr base_{nullptr, &event_base_free}; - std::unique_ptr socket_event_{nullptr, &event_free}; - std::unique_ptr signal_event_{nullptr, &event_free}; std::unique_ptr remote_memory_; + Channel channel_; + bool running_ = false; + pid_t pid_; + + void setup_events(); // Part of the initialization + void clear_memory_cache(); + void handle_waitpid(); public: - explicit CheckerSide(int sockfd, std::unique_ptr mem); + explicit CheckerSide(const std::vector& args, bool need_memory_introspection); + ~CheckerSide(); // No copy: CheckerSide(CheckerSide const&) = delete; CheckerSide& operator=(CheckerSide const&) = delete; CheckerSide& operator=(CheckerSide&&) = delete; + /* Communicating with the application */ Channel const& get_channel() const { return channel_; } Channel& get_channel() { return channel_; } - RemoteProcessMemory& get_remote_memory() { return *remote_memory_.get(); } + bool handle_message(const char* buffer, ssize_t size); void dispatch_events() const; void break_loop() const; + void wait_for_requests(); + + /** Ask the application to run post-mortem analysis, and maybe to stop ASAP */ + void finalize(bool terminate_asap = false); + + /* Interacting with the application process */ + pid_t get_pid() const { return pid_; } + bool running() const { return running_; } + void terminate() { running_ = false; } + RemoteProcessMemory* get_remote_memory() { return remote_memory_.get(); } }; } // namespace simgrid::mc