X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3080c6b0d097d6b3b7d5b3dda0592154ce438f64..31a999f9a0f6420f98301e553cb0e5f0c8b2a1c8:/src/mc/mc_ignore.c?ds=sidebyside diff --git a/src/mc/mc_ignore.c b/src/mc/mc_ignore.c index 8fab43ca0f..1f6dd21cee 100644 --- a/src/mc/mc_ignore.c +++ b/src/mc/mc_ignore.c @@ -4,7 +4,9 @@ /* 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 "internal_config.h" #include "mc_private.h" +#include "smpi/private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ignore, mc, "Logging specific to MC ignore mechanism"); @@ -71,18 +73,16 @@ void MC_ignore_heap(void *address, size_t size) region->block = ((char *) address - - (char *) ((xbt_mheap_t) std_heap)->heapbase) / BLOCKSIZE + 1; + (char *) std_heap->heapbase) / BLOCKSIZE + 1; - if (((xbt_mheap_t) std_heap)->heapinfo[region->block].type == 0) { + if (std_heap->heapinfo[region->block].type == 0) { region->fragment = -1; - ((xbt_mheap_t) std_heap)->heapinfo[region->block].busy_block.ignore++; + std_heap->heapinfo[region->block].busy_block.ignore++; } else { region->fragment = - ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >> ((xbt_mheap_t) - std_heap)-> + ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >> std_heap-> heapinfo[region->block].type; - ((xbt_mheap_t) std_heap)->heapinfo[region->block].busy_frag.ignore[region-> - fragment]++; + std_heap->heapinfo[region->block].busy_frag.ignore[region->fragment]++; } if (mc_heap_comparison_ignore == NULL) { @@ -224,7 +224,8 @@ 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 (subprogram_name == NULL || strcmp(subprogram_name, subprogram->name) == 0) { + if (!subprogram_name || + (subprogram->name && strcmp(subprogram_name, subprogram->name) == 0)) { // Try to find the variable and remove it: int start = 0; @@ -299,7 +300,18 @@ void MC_ignore_local_variable(const char *var_name, const char *frame_name) } -void MC_new_stack_area(void *stack, char *name, void *context, size_t size) +/** @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 + * they are with this function. + * + * @param stack + * @param process Process owning the stack + * @param context + * @param size Size of the stack + */ +void MC_new_stack_area(void *stack, smx_process_t process, void *context, size_t size) { int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -312,12 +324,19 @@ void MC_new_stack_area(void *stack, char *name, void *context, size_t size) stack_region_t region = NULL; region = xbt_new0(s_stack_region_t, 1); region->address = stack; - region->process_name = strdup(name); + region->process_name = process && process->name ? strdup(process->name) : NULL; region->context = context; region->size = size; region->block = ((char *) stack - - (char *) ((xbt_mheap_t) std_heap)->heapbase) / BLOCKSIZE + 1; + (char *) std_heap->heapbase) / BLOCKSIZE + 1; +#ifdef HAVE_SMPI + if (smpi_privatize_global_variables && process) { + region->process_index = smpi_process_index_of_smx_process(process); + } else +#endif + region->process_index = -1; + xbt_dynar_push(stacks_areas, ®ion); if (!raw_mem_set)