X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe6a4a0cfb04cbe8c0bbd93c7bf6c29ec017ddec..3959a22b008b3db13750b10bc76f24e4404155d2:/src/mc/explo/Exploration.hpp diff --git a/src/mc/explo/Exploration.hpp b/src/mc/explo/Exploration.hpp index 68f0f97256..64114d4bf2 100644 --- a/src/mc/explo/Exploration.hpp +++ b/src/mc/explo/Exploration.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2016-2023. 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. */ @@ -6,7 +6,14 @@ #ifndef SIMGRID_MC_CHECKER_HPP #define SIMGRID_MC_CHECKER_HPP -#include "src/mc/api.hpp" +#include "simgrid/forward.h" +#include "src/mc/api/RemoteApp.hpp" +#include "src/mc/mc_config.hpp" +#include "src/mc/mc_exit.hpp" +#include "src/mc/mc_record.hpp" +#include + +#include namespace simgrid::mc { @@ -23,43 +30,52 @@ namespace simgrid::mc { * `RemoteApp` interface (that is currently not perfectly sufficient to that extend). */ // abstract class Exploration : public xbt::Extendable { - RemoteApp& remote_app_; + std::unique_ptr remote_app_; + static Exploration* instance_; + + FILE* dot_output_ = nullptr; public: - explicit Exploration(RemoteApp& remote_app) : remote_app_(remote_app) {} + explicit Exploration(const std::vector& args, bool need_memory_introspection); + virtual ~Exploration(); + static Exploration* get_instance() { return instance_; } // No copy: - Exploration(Exploration const&) = delete; + Exploration(Exploration const&) = delete; Exploration& operator=(Exploration const&) = delete; - virtual ~Exploration() = default; - /** Main function of this algorithm */ virtual void run() = 0; + /** Produce an error message indicating that the application crashed (status was produced by waitpid) */ + XBT_ATTRIB_NORETURN void report_crash(int status); + /** Produce an error message indicating that a property was violated */ + XBT_ATTRIB_NORETURN void report_assertion_failure(); + /* These methods are callbacks called by the model-checking engine * to get and display information about the current state of the * model-checking algorithm: */ - /** Show the current trace/stack - * - * Could this be handled in the Session/ModelChecker instead? */ + /** Retrieve the current stack to build an execution trace */ virtual RecordTrace get_record_trace() = 0; /** Generate a textual execution trace of the simulated application */ - virtual std::vector get_textual_trace() = 0; + std::vector get_textual_trace(); /** Log additional information about the state of the model-checker */ - virtual void log_state() = 0; + virtual void log_state(); + + RemoteApp& get_remote_app() { return *remote_app_.get(); } - RemoteApp& get_remote_app() { return remote_app_; } + /** Print something to the dot output file*/ + void dot_output(const char* fmt, ...) XBT_ATTRIB_PRINTF(2, 3); }; // External constructors so that the types (and the types of their content) remain hidden -XBT_PUBLIC Exploration* create_liveness_checker(RemoteApp& remote_app); -XBT_PUBLIC Exploration* create_dfs_exploration(RemoteApp& remote_app); -XBT_PUBLIC Exploration* create_communication_determinism_checker(RemoteApp& remote_app); -XBT_PUBLIC Exploration* create_udpor_checker(RemoteApp& remote_app); +XBT_PUBLIC Exploration* create_liveness_checker(const std::vector& args); +XBT_PUBLIC Exploration* create_dfs_exploration(const std::vector& args, ReductionMode mode); +XBT_PUBLIC Exploration* create_communication_determinism_checker(const std::vector& args, ReductionMode mode); +XBT_PUBLIC Exploration* create_udpor_checker(const std::vector& args); } // namespace simgrid::mc