X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/62ef333af12243ec6a04be079bd94081fd2372f0..718cf4ba4da6d6032f60d8c4c432807b9c018185:/src/mc/mc_compare.c diff --git a/src/mc/mc_compare.c b/src/mc/mc_compare.c index bfa1332a1a..b9ea20c69a 100644 --- a/src/mc/mc_compare.c +++ b/src/mc/mc_compare.c @@ -151,13 +151,8 @@ static int compare_areas_with_type(void *area1, void *area2, mc_object_info_t in case DW_TAG_structure_type: case DW_TAG_union_type: if(subtype->byte_size == 0){ /*declaration of the type, need the complete description */ - dw_type_t full_type = xbt_dict_get_or_null(other_info->types_by_name, subtype->name); - if(full_type) { - type = full_type; - } else { subtype = xbt_dict_get_or_null(other_info->types_by_name, subtype->name); switch_types = 1; - } } elm_size = subtype->byte_size; break; @@ -209,14 +204,14 @@ static int compare_areas_with_type(void *area1, void *area2, mc_object_info_t in // The pointers are both in the heap: if(addr_pointed1 > std_heap && (char *)addr_pointed1 < (char*) std_heap + STD_HEAP_SIZE){ if(!(addr_pointed2 > std_heap && (char *)addr_pointed2 < (char*) std_heap + STD_HEAP_SIZE)) - xbt_die("Die"); + return 1; return compare_heap_area(addr_pointed1, addr_pointed2, NULL, info, other_info, type->dw_type_id, pointer_level); } // The pointers are both in the current object R/W segment: else if(addr_pointed1 > start_data && (char*)addr_pointed1 <= (char *)start_data + region_size){ if(!(addr_pointed2 > start_data && (char*)addr_pointed2 <= (char *)start_data + region_size)) - xbt_die("Die"); + return 1; if(type->dw_type_id == NULL) return (addr_pointed1 != addr_pointed2); else @@ -283,11 +278,11 @@ static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_ // If the variable is not in this object, skip it: // We do not expect to find a pointer to something which is not reachable // by the global variables. - if((char*) current_var->address.address < (char*) object_info->start_rw - || (char*) current_var->address.address > (char*) object_info->end_rw) + if((char*) current_var->address < (char*) object_info->start_rw + || (char*) current_var->address > (char*) object_info->end_rw) continue; - offset = (char *)current_var->address.address - (char *)object_info->start_rw; + offset = (char *)current_var->address - (char *)object_info->start_rw; dw_type_t bvariable_type = xbt_dict_get_or_null(object_info->types, current_var->type_origin); res = compare_areas_with_type((char *)r1->data + offset, (char *)r2->data + offset, object_info, other_object_info, bvariable_type, r1->size, region_type, start_data, 0); @@ -395,10 +390,14 @@ int snapshot_compare(void *state1, void *state2){ xbt_os_walltimer_start(timer); #endif + int hash_result = 0; if(MC_USE_SNAPSHOT_HASH) { - if(s1->hash != s2->hash) { + hash_result = (s1->hash != s2->hash); + if(hash_result) { XBT_VERB("(%d - %d) Different hash : 0x%" PRIx64 "--0x%" PRIx64, num1, num2, s1->hash, s2->hash); +#ifndef MC_DEBUG return 1; +#endif } else { XBT_VERB("(%d - %d) Same hash : 0x%" PRIx64, num1, num2, s1->hash); } @@ -603,10 +602,22 @@ int snapshot_compare(void *state1, void *state2){ #endif #ifdef MC_VERBOSE - if(errors==0) + if(errors || hash_result) + XBT_VERB("(%d - %d) Difference found", num1, num2); + else XBT_VERB("(%d - %d) No difference found", num1, num2); #endif - return errors > 0; + +#if defined(MC_DEBUG) && defined(MC_VERBOSE) && MC_USE_SNAPSHOT_HASH + // * false positive SHOULD be avoided. + // * There MUST not be any false negative. + + XBT_VERB("(%d - %d) State equality hash test is %s %s", num1, num2, + (hash_result!=0) == (errors!=0) ? "true" : "false", + !hash_result ? "positive" : "negative"); +#endif + + return errors > 0 || hash_result; }