X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/824740eb0df1dedddb86035ff3730d87e037f356..cfa35c4fa9a6bcfa6aa8f8cf21da6ab292ea21ad:/src/mc/remote/AppSide.cpp diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index f6b53c9686..3c5b688f19 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -40,16 +40,18 @@ namespace simgrid::mc { std::unique_ptr AppSide::instance_; -AppSide* AppSide::initialize() +AppSide* AppSide::get() { - if (not std::getenv(MC_ENV_SOCKET_FD)) // We are not in MC mode: don't initialize the MC world + // Only initialize the MC world once + if (instance_ != nullptr) + return instance_.get(); + + if (std::getenv(MC_ENV_SOCKET_FD) == nullptr) // We are not in MC mode: don't initialize the MC world return nullptr; - // Do not break if we are called multiple times: - if (instance_) - return instance_.get(); + XBT_DEBUG("Initialize the MC world. MC_NEED_PTRACE=%s", std::getenv("MC_NEED_PTRACE")); - simgrid::mc::model_checking_mode = ModelCheckingMode::APP_SIDE; + simgrid::mc::set_model_checking_mode(ModelCheckingMode::APP_SIDE); setvbuf(stdout, nullptr, _IOLBF, 0); @@ -176,6 +178,8 @@ void AppSide::handle_fork(const s_mc_message_int_t* msg) answer.type = MessageType::FORK_REPLY; answer.value = getpid(); xbt_assert(channel_.send(answer) == 0, "Could not send response to WAIT_CHILD_REPLY: %s", strerror(errno)); + } else { + XBT_DEBUG("App %d forks subprocess %d.", getpid(), pid); } } void AppSide::handle_wait_child(const s_mc_message_int_t* msg)