X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e7c2b72c7328c4aade5049a3cc21603a9d27842c..ec55718ba94dcbd675ef6bc9cfc2e504f7a3e428:/src/mc/simgrid_mc.cpp diff --git a/src/mc/simgrid_mc.cpp b/src/mc/simgrid_mc.cpp index 409acb5774..2b1f204d13 100644 --- a/src/mc/simgrid_mc.cpp +++ b/src/mc/simgrid_mc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2015. The SimGrid Team. + /* Copyright (c) 2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -28,8 +29,9 @@ #include "mc_private.h" #include "mc_protocol.h" #include "mc_server.h" -#include "mc_model_checker.h" #include "mc_safety.h" +#include "mc_comm_pattern.h" +#include "mc_liveness.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc"); @@ -38,6 +40,10 @@ static const bool trace = true; static int do_child(int socket, char** argv) { XBT_DEBUG("Inside the child process PID=%i", (int) getpid()); + if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0) { + std::perror("simgrid-mc"); + return MC_SERVER_ERROR; + } int res; // Remove CLOEXEC in order to pass the socket to the exec-ed program: @@ -76,29 +82,18 @@ static int do_parent(int socket, pid_t child) mc_mode = MC_MODE_SERVER; mc_server = new s_mc_server(child, socket); mc_server->start(); - MC_init_pid(child, socket); - - if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { - mc_server->loop(); - } - - else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0') { - if (mc_reduce_kind == e_mc_reduce_unset) - mc_reduce_kind = e_mc_reduce_dpor; - XBT_INFO("Check a safety property"); - MC_wait_for_requests(); + MC_init_model_checker(child, socket); + if (_sg_mc_comms_determinism || _sg_mc_send_determinism) + MC_modelcheck_comm_determinism(); + else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0') MC_modelcheck_safety(); - } - - else { - mc_server->loop(); - } - + else + MC_modelcheck_liveness(); mc_server->shutdown(); mc_server->exit(); } catch(std::exception& e) { - XBT_ERROR(e.what()); + XBT_ERROR("Exception: %s", e.what()); } exit(MC_SERVER_ERROR); }