X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1847d1441271d076b3de449c8853031ea208ce8f..39cf43e4e190f5053b971b13ff1a1d82ebea5dba:/src/mc/remote/Client.cpp diff --git a/src/mc/remote/Client.cpp b/src/mc/remote/Client.cpp index 20b9c2dcbb..71d790dbfc 100644 --- a/src/mc/remote/Client.cpp +++ b/src/mc/remote/Client.cpp @@ -1,32 +1,21 @@ -/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "src/mc/remote/Client.hpp" +#include "src/internal_config.h" +#include + #include #include - +#include #include #include #include -#include -#include -#include -#include - -#include - -#include "src/internal_config.h" - -#include "src/mc/mc_request.h" -#include "src/mc/remote/Client.hpp" -#include "src/mc/remote/mc_protocol.h" - -#include "src/smpi/include/private.hpp" - // We won't need those once the separation MCer/MCed is complete: -#include "src/mc/mc_smx.h" +#include "src/mc/mc_smx.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic"); @@ -61,11 +50,11 @@ Client* Client::initialize() socklen_t socklen = sizeof(type); if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0) xbt_die("Could not check socket type"); - if (type != SOCK_DGRAM) + if (type != SOCK_SEQPACKET) xbt_die("Unexpected socket type %i", type); XBT_DEBUG("Model-checked application found expected socket type"); - instance_ = std::unique_ptr(new simgrid::mc::Client(fd)); + instance_.reset(new simgrid::mc::Client(fd)); // Wait for the model-checker: errno = 0; @@ -77,13 +66,13 @@ Client* Client::initialize() #error "no ptrace equivalent coded for this platform" #endif if (errno != 0 || raise(SIGSTOP) != 0) - xbt_die("Could not wait for the model-checker"); + xbt_die("Could not wait for the model-checker (errno = %d: %s)", errno, strerror(errno)); instance_->handleMessages(); return instance_.get(); } -void Client::handleDeadlockCheck(mc_message_t* msg) +void Client::handleDeadlockCheck(s_mc_message_t*) { bool deadlock = false; if (not simix_global->process_list.empty()) { @@ -96,10 +85,10 @@ void Client::handleDeadlockCheck(mc_message_t* msg) } // Send result: - mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock}; + s_mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock}; xbt_assert(channel_.send(answer) == 0, "Could not send response"); } -void Client::handleContinue(mc_message_t* msg) +void Client::handleContinue(s_mc_message_t*) { /* Nothing to do */ } @@ -112,16 +101,11 @@ void Client::handleSimcall(s_mc_message_simcall_handle_t* message) if (channel_.send(MC_MESSAGE_WAITING)) xbt_die("Could not send MESSAGE_WAITING to model-checker"); } -void Client::handleRestore(s_mc_message_restore_t* message) -{ -#if HAVE_SMPI - smpi_really_switch_data_segment(message->index); -#endif -} + void Client::handleActorEnabled(s_mc_message_actor_enabled_t* msg) { bool res = simgrid::mc::actor_is_enabled(SIMIX_process_from_PID(msg->aid)); - s_mc_message_int answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res}; + s_mc_message_int_t answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res}; channel_.send(answer); } @@ -136,18 +120,18 @@ void Client::handleMessages() if (received_size < 0) xbt_die("Could not receive commands from the model-checker"); - mc_message_t* message = (mc_message_t*)message_buffer; + s_mc_message_t* message = (s_mc_message_t*)message_buffer; switch (message->type) { case MC_MESSAGE_DEADLOCK_CHECK: - xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)", - received_size, sizeof(mc_message_t)); + xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)", + received_size, sizeof(s_mc_message_t)); handleDeadlockCheck(message); break; case MC_MESSAGE_CONTINUE: - xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_CONTINUE (%zd != %zu)", - received_size, sizeof(mc_message_t)); + xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for MESSAGE_CONTINUE (%zd != %zu)", + received_size, sizeof(s_mc_message_t)); handleContinue(message); return; @@ -158,12 +142,6 @@ void Client::handleMessages() handleSimcall((s_mc_message_simcall_handle_t*)message_buffer); break; - case MC_MESSAGE_RESTORE: - xbt_assert(received_size == sizeof(mc_message_t), "Unexpected size for MESSAGE_RESTORE (%zd != %zu)", - received_size, sizeof(mc_message_t)); - handleRestore((s_mc_message_restore_t*)message_buffer); - break; - case MC_MESSAGE_ACTOR_ENABLED: xbt_assert(received_size == sizeof(s_mc_message_actor_enabled_t), "Unexpected size for ACTOR_ENABLED (%zd != %zu)", received_size, @@ -187,7 +165,7 @@ void Client::mainLoop() } } -void Client::reportAssertionFailure(const char* description) +void Client::reportAssertionFailure() { if (channel_.send(MC_MESSAGE_ASSERTION_FAILED)) xbt_die("Could not send assertion to model-checker"); @@ -258,12 +236,6 @@ void Client::declareStack(void* stack, size_t size, smx_actor_t process, ucontex region.context = context; region.size = size; region.block = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1; -#if HAVE_SMPI - if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP && process) - region.process_index = process->pid - 1; - else -#endif - region.process_index = -1; s_mc_message_stack_region_t message; message.type = MC_MESSAGE_STACK_REGION;