X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/225476182e5558b35f3e22f3fa6dcf52af1dec28..d63e6e420e35b2df639d3a774abb79d004608627:/src/mc/mc_ignore.c?ds=sidebyside diff --git a/src/mc/mc_ignore.c b/src/mc/mc_ignore.c index 1f6dd21cee..e16383a23e 100644 --- a/src/mc/mc_ignore.c +++ b/src/mc/mc_ignore.c @@ -5,8 +5,10 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "internal_config.h" +#include "mc_object_info.h" #include "mc_private.h" #include "smpi/private.h" +#include "mc/mc_snapshot.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ignore, mc, "Logging specific to MC ignore mechanism"); @@ -59,8 +61,11 @@ static void checkpoint_ignore_region_free_voidp(void *r) /***********************************************************************/ +// FIXME, cross-process support? (or make this it is used on the app-side) void MC_ignore_heap(void *address, size_t size) { + if(!std_heap) + return; int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -171,33 +176,37 @@ void MC_remove_ignore_heap(void *address, size_t size) } +// FIXME, cross-process support? void MC_ignore_global_variable(const char *name) { - + mc_process_t process = &mc_model_checker->process; int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); MC_SET_MC_HEAP; - xbt_assert(mc_libsimgrid_info, "MC subsystem not initialized"); + xbt_assert(process->object_infos, "MC subsystem not initialized"); - unsigned int cursor = 0; - dw_variable_t current_var; - int start = 0; - int end = xbt_dynar_length(mc_libsimgrid_info->global_variables) - 1; + size_t n = process->object_infos_size; + for (size_t i=0; i!=n; ++i) { + mc_object_info_t info = process->object_infos[i]; - while (start <= end) { - cursor = (start + end) / 2; - current_var = - (dw_variable_t) xbt_dynar_get_as(mc_libsimgrid_info->global_variables, - cursor, dw_variable_t); - if (strcmp(current_var->name, name) == 0) { - xbt_dynar_remove_at(mc_libsimgrid_info->global_variables, cursor, NULL); - start = 0; - end = xbt_dynar_length(mc_libsimgrid_info->global_variables) - 1; - } else if (strcmp(current_var->name, name) < 0) { - start = cursor + 1; - } else { - end = cursor - 1; + // Binary search: + int start = 0; + int end = xbt_dynar_length(info->global_variables) - 1; + while (start <= end) { + unsigned int cursor = (start + end) / 2; + dw_variable_t current_var = + (dw_variable_t) xbt_dynar_get_as(info->global_variables, + cursor, dw_variable_t); + if (strcmp(current_var->name, name) == 0) { + xbt_dynar_remove_at(info->global_variables, cursor, NULL); + start = 0; + end = xbt_dynar_length(info->global_variables) - 1; + } else if (strcmp(current_var->name, name) < 0) { + start = cursor + 1; + } else { + end = cursor - 1; + } } } @@ -216,6 +225,7 @@ void MC_ignore_global_variable(const char *name) * \param subprogram (possibly inlined) Subprogram of the scope * \param scope Current scope */ + // FIXME, cross-process support (messaging?) static void mc_ignore_local_variable_in_scope(const char *var_name, const char *subprogram_name, dw_frame_t subprogram, @@ -223,7 +233,7 @@ static void mc_ignore_local_variable_in_scope(const char *var_name, { // Processing of direct variables: - // If the current subprogram matche the given name: + // If the current subprogram matches the given name: if (!subprogram_name || (subprogram->name && strcmp(subprogram_name, subprogram->name) == 0)) { @@ -283,6 +293,8 @@ static void MC_ignore_local_variable_in_object(const char *var_name, void MC_ignore_local_variable(const char *var_name, const char *frame_name) { + mc_process_t process = &mc_model_checker->process; + int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -291,9 +303,11 @@ void MC_ignore_local_variable(const char *var_name, const char *frame_name) MC_SET_MC_HEAP; - MC_ignore_local_variable_in_object(var_name, frame_name, mc_libsimgrid_info); - if (frame_name != NULL) - MC_ignore_local_variable_in_object(var_name, frame_name, mc_binary_info); + size_t n = process->object_infos_size; + size_t i; + for (i=0; i!=n; ++i) { + MC_ignore_local_variable_in_object(var_name, frame_name, process->object_infos[i]); + } if (!raw_mem_set) MC_SET_STD_HEAP; @@ -303,7 +317,7 @@ void MC_ignore_local_variable(const char *var_name, const char *frame_name) /** @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 theap so it must be told where + * when we analyse/compare the content of the heap so it must be told where * they are with this function. * * @param stack @@ -350,6 +364,7 @@ void MC_ignore(void *addr, size_t size) MC_SET_MC_HEAP; + // FIXME, cross-process support if (mc_checkpoint_ignore == NULL) mc_checkpoint_ignore = xbt_dynar_new(sizeof(mc_checkpoint_ignore_region_t),