X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab8e2fe95944fb998edd6e95d1022a05175c4f92..206d7d160214aa24cde2adc4dfc25a3b4abba2cd:/src/mc/mc_client_api.cpp diff --git a/src/mc/mc_client_api.cpp b/src/mc/mc_client_api.cpp index 8a0418f25f..0e4fcf05ef 100644 --- a/src/mc/mc_client_api.cpp +++ b/src/mc/mc_client_api.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include "src/mc/mc_record.h" @@ -16,7 +15,7 @@ #include "src/mc/Client.hpp" #include "src/mc/ModelChecker.hpp" -/** \file mc_client_api.cpp +/** @file mc_client_api.cpp * * This is the implementation of the API used by the user simulated program to * communicate with the MC (declared in modelchecker.h). @@ -29,39 +28,41 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc, void MC_assert(int prop) { + xbt_assert(mc_model_checker == nullptr); if (MC_is_active() && !prop) simgrid::mc::Client::get()->reportAssertionFailure(); } void MC_cut(void) { + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) + return; // FIXME, We want to do this in the model-checker: xbt_die("MC_cut() not implemented"); } void MC_ignore(void* addr, size_t size) { - xbt_assert(mc_mode != MC_MODE_SERVER); - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; simgrid::mc::Client::get()->ignoreMemory(addr, size); } void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void)) { - xbt_assert(mc_mode != MC_MODE_SERVER); - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; - xbt_die("Support for client-side function proposition is not implemented: " - "use MC_automaton_new_propositional_symbol_pointer instead." - ); + "use MC_automaton_new_propositional_symbol_pointer instead."); } void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value) { - xbt_assert(mc_mode != MC_MODE_SERVER); - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; simgrid::mc::Client::get()->declareSymbol(name, value); } @@ -69,7 +70,7 @@ void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value) /** @brief Register a stack in the model checker * * The stacks are allocated in the heap. The MC handle them especially - * when we analyse/compare the content of the heap so it must be told where + * when we analyze/compare the content of the heap so it must be told where * they are with this function. * * @param stack @@ -79,27 +80,33 @@ void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value) */ void MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size) { - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; simgrid::mc::Client::get()->declareStack(stack, size, process, context); } void MC_ignore_global_variable(const char *name) { + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) + return; // TODO, send a message to the model_checker xbt_die("Unimplemented"); } void MC_ignore_heap(void *address, size_t size) { - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; simgrid::mc::Client::get()->ignoreHeap(address, size); } void MC_remove_ignore_heap(void *address, size_t size) { - if (mc_mode != MC_MODE_CLIENT) + xbt_assert(mc_model_checker == nullptr); + if (!MC_is_active()) return; simgrid::mc::Client::get()->unignoreHeap(address, size); }