X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3ae513c025c03178cb746e93852999a0f9d4b911..0e7d247670cc012d8e784d0c8bcbb70a1c0bb9c6:/src/mc/ModelChecker.cpp diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index d5a81954b4..53ebd7efbd 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2015. The SimGrid Team. +/* Copyright (c) 2008-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -26,14 +26,15 @@ #include "src/mc/PageStore.hpp" #include "src/mc/Transition.hpp" #include "src/mc/checker/Checker.hpp" -#include "src/mc/mc_exit.h" -#include "src/mc/mc_private.h" -#include "src/mc/mc_record.h" +#include "src/mc/mc_exit.hpp" +#include "src/mc/mc_private.hpp" +#include "src/mc/mc_record.hpp" #include "src/mc/remote/mc_protocol.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ModelChecker, mc, "ModelChecker"); ::simgrid::mc::ModelChecker* mc_model_checker = nullptr; +extern std::string _sg_mc_dot_output_file; using simgrid::mc::remote; @@ -96,7 +97,7 @@ void ModelChecker::start() process_->init(); - if ((_sg_mc_dot_output_file != nullptr) && (_sg_mc_dot_output_file[0] != '\0')) + if (not _sg_mc_dot_output_file.empty()) MC_init_dot_output(); setup_ignore(); @@ -147,7 +148,7 @@ void ModelChecker::shutdown() simgrid::mc::RemoteClient* process = &this->process(); if (process->running()) { XBT_DEBUG("Killing process"); - kill(process->pid(), SIGTERM); + kill(process->pid(), SIGKILL); process->terminate(); } } @@ -175,7 +176,7 @@ static void MC_report_crash(int status) XBT_INFO("No core dump was generated by the system."); XBT_INFO("Counter-example execution trace:"); simgrid::mc::dumpRecordPath(); - for (auto& s : mc_model_checker->getChecker()->getTextualTrace()) + for (auto const& s : mc_model_checker->getChecker()->getTextualTrace()) XBT_INFO("%s", s.c_str()); simgrid::mc::session->logState(); XBT_INFO("Stack trace:"); @@ -189,14 +190,14 @@ static void MC_report_assertion_error() XBT_INFO("**************************"); XBT_INFO("Counter-example execution trace:"); simgrid::mc::dumpRecordPath(); - for (auto& s : mc_model_checker->getChecker()->getTextualTrace()) + for (auto const& s : mc_model_checker->getChecker()->getTextualTrace()) XBT_INFO("%s", s.c_str()); simgrid::mc::session->logState(); } bool ModelChecker::handle_message(char* buffer, ssize_t size) { - mc_message_t base_message; + s_mc_message_t base_message; if (size < (ssize_t) sizeof(base_message)) xbt_die("Broken message"); memcpy(&base_message, buffer, sizeof(base_message)); @@ -375,13 +376,8 @@ void ModelChecker::handle_waitpid() void ModelChecker::on_signal(int signo) { - switch(signo) { - case SIGCHLD: + if (signo == SIGCHLD) this->handle_waitpid(); - break; - default: - break; - } } void ModelChecker::wait_for_requests() @@ -393,7 +389,7 @@ void ModelChecker::wait_for_requests() void ModelChecker::handle_simcall(Transition const& transition) { - s_mc_message_simcall_handle m; + s_mc_message_simcall_handle_t m; memset(&m, 0, sizeof(m)); m.type = MC_MESSAGE_SIMCALL_HANDLE; m.pid = transition.pid; @@ -409,7 +405,7 @@ bool ModelChecker::checkDeadlock() int res; if ((res = this->process().getChannel().send(MC_MESSAGE_DEADLOCK_CHECK))) xbt_die("Could not check deadlock state"); - mc_message_int_t message; + s_mc_message_int_t message; ssize_t s = mc_model_checker->process().getChannel().receive(message); if (s == -1) xbt_die("Could not receive message");