X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/911d1bc49601ee2681cffec46ea85d83420f832e..8eee56e65b8c3493da1e5f7f76278223ad0f4f5b:/src/mc/ModelChecker.cpp diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index f50fac1a16..0bd8683d1e 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -53,8 +53,6 @@ ModelChecker::~ModelChecker() { void ModelChecker::start() { - const pid_t pid = process_->pid(); - base_ = event_base_new(); event_callback_fn event_callback = [](evutil_socket_t fd, short events, void *arg) { @@ -72,6 +70,8 @@ void ModelChecker::start() int status; // The model-checked process SIGSTOP itself to signal it's ready: + const pid_t pid = process_->pid(); + pid_t res = waitpid(pid, &status, WAITPID_CHECKED_FLAGS); if (res < 0 || not WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP) xbt_die("Could not wait model-checked process"); @@ -141,17 +141,19 @@ static void MC_report_crash(int status) XBT_INFO("From signal: %s", strsignal(WTERMSIG(status))); else if (WIFEXITED(status)) XBT_INFO("From exit: %i", WEXITSTATUS(status)); - if (WCOREDUMP(status)) - XBT_INFO("A core dump was generated by the system."); - else - XBT_INFO("No core dump was generated by the system."); + if (not xbt_log_no_loc) + XBT_INFO("%s core dump was generated by the system.", WCOREDUMP(status) ? "A" : "No"); XBT_INFO("Counter-example execution trace:"); for (auto const& s : mc_model_checker->getChecker()->get_textual_trace()) XBT_INFO(" %s", s.c_str()); simgrid::mc::dumpRecordPath(); simgrid::mc::session->log_state(); - XBT_INFO("Stack trace:"); - mc_model_checker->process().dump_stack(); + if (xbt_log_no_loc) { + XBT_INFO("Stack trace not displayed because you passed --log=no_loc"); + } else { + XBT_INFO("Stack trace:"); + mc_model_checker->process().dump_stack(); + } } static void MC_report_assertion_error() @@ -336,7 +338,10 @@ void ModelChecker::handle_waitpid() xbt_die("Could not PTRACE_CONT"); } - else if (WIFEXITED(status) || WIFSIGNALED(status)) { + else if (WIFSIGNALED(status)) { + MC_report_crash(status); + mc_model_checker->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH); + } else if (WIFEXITED(status)) { XBT_DEBUG("Child process is over"); this->process().terminate(); }