* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/ModelChecker.hpp"
-#include "src/mc/Session.hpp"
#include "src/mc/explo/Exploration.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_exit.hpp"
::simgrid::mc::ModelChecker* mc_model_checker = nullptr;
-using simgrid::mc::remote;
-
#ifdef __linux__
# define WAITPID_CHECKED_FLAGS __WALL
#else
# define WAITPID_CHECKED_FLAGS 0
#endif
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
ModelChecker::ModelChecker(std::unique_ptr<RemoteProcess> remote_simulation, int sockfd)
: checker_side_(sockfd), remote_process_(std::move(remote_simulation))
setup_ignore();
+ errno = 0;
#ifdef __linux__
ptrace(PTRACE_SETOPTIONS, pid, nullptr, PTRACE_O_TRACEEXIT);
ptrace(PTRACE_CONT, pid, 0, 0);
#else
# error "no ptrace equivalent coded for this platform"
#endif
+ xbt_assert(errno == 0,
+ "Ptrace does not seem to be usable in your setup (errno: %d). "
+ "If you run from within a docker, adding `--cap-add SYS_PTRACE` to the docker line may help. "
+ "If it does not help, please report this bug.",
+ errno);
}
static constexpr auto ignored_local_variables = {
void ModelChecker::setup_ignore()
{
const RemoteProcess& process = this->get_remote_process();
- for (auto const& var : ignored_local_variables)
- process.ignore_local_variable(var.first, var.second);
+ for (auto const& [var, frame] : ignored_local_variables)
+ process.ignore_local_variable(var, frame);
/* Static variable used for tracing */
process.ignore_global_variable("counter");
void ModelChecker::resume()
{
- int res = checker_side_.get_channel().send(MessageType::CONTINUE);
- if (res)
+ if (checker_side_.get_channel().send(MessageType::CONTINUE) != 0)
throw xbt::errno_error();
remote_process_->clear_cache();
}
for (auto const& s : mc_model_checker->get_exploration()->get_textual_trace())
XBT_INFO(" %s", s.c_str());
XBT_INFO("Path = %s", mc_model_checker->get_exploration()->get_record_trace().to_string().c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
if (xbt_log_no_loc) {
XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
} else {
for (auto const& s : get_exploration()->get_textual_trace())
XBT_INFO(" %s", s.c_str());
XBT_INFO("Path = %s", get_exploration()->get_record_trace().to_string().c_str());
- session_singleton->log_state();
+ Api::get().get_session().log_state();
this->exit(SIMGRID_MC_EXIT_SAFETY);
xbt_assert(checker_side_.get_channel().receive(answer) != -1, "Could not receive answer to FINALIZE");
}
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc