From: Gabriel Corona Date: Fri, 7 Feb 2014 12:16:09 +0000 (+0100) Subject: Merge branch mc into mc-perf X-Git-Tag: v3_11~199^2~2^2~24^2~18 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/71b11e6426999ead46f97083ad7eec3f288c9cdb?hp=28c5e894dc6ed5d5d45a834aa9fef5cfe6f15fa7 Merge branch mc into mc-perf --- diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index 97a9b7ed24..035e6b5b8e 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -397,8 +397,11 @@ static xbt_dynar_t MC_get_local_variables_values(void *stack_context){ new_var->type = strdup(current_variable->type_origin); new_var->region= region_type; - if(current_variable->address.location != NULL){ - new_var->address = (void*) MC_dwarf_resolve_location(&c, current_variable->address.location, frame_pointer_address); + /* if(current_variable->address!=NULL) { + new_var->address = current_variable->address; + } else */ + if(current_variable->location != NULL){ + new_var->address = (void*) MC_dwarf_resolve_location(&c, current_variable->location, frame_pointer_address); } xbt_dynar_push(variables, &new_var); diff --git a/src/mc/mc_compare.c b/src/mc/mc_compare.c index bfa1332a1a..69184599b8 100644 --- a/src/mc/mc_compare.c +++ b/src/mc/mc_compare.c @@ -283,11 +283,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); diff --git a/src/mc/mc_dpor.c b/src/mc/mc_dpor.c index 85d654082f..507b6df393 100644 --- a/src/mc/mc_dpor.c +++ b/src/mc/mc_dpor.c @@ -586,6 +586,7 @@ void MC_dpor(void) } MC_SET_RAW_MEM; + if(0) { if(!initial_state_safety->initial_communications_pattern_done){ print_communications_pattern(initial_communications_pattern); }else{ @@ -595,6 +596,7 @@ void MC_dpor(void) } } initial_state_safety->initial_communications_pattern_done = 1; + } MC_UNSET_RAW_MEM; /* Trash the current state, no longer needed */ diff --git a/src/mc/mc_dwarf.c b/src/mc/mc_dwarf.c index d830f23e73..3ff5e98ab2 100644 --- a/src/mc/mc_dwarf.c +++ b/src/mc/mc_dwarf.c @@ -814,7 +814,6 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D variable->global = frame == NULL; // Can be override base on DW_AT_location variable->name = xbt_strdup(MC_dwarf_attr_string(die, DW_AT_name)); variable->type_origin = MC_dwarf_at_type(die); - variable->address.address = NULL; int klass = MC_dwarf_form_get_class(dwarf_whatform(&attr_location)); switch (klass) { @@ -835,9 +834,9 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D Dwarf_Off offset = expr[0].number; // TODO, Why is this different base on the object? Dwarf_Off base = strcmp(info->file_name, xbt_binary_name) !=0 ? (Dwarf_Off) info->start_exec : 0; - variable->address.address = (void*) (base + offset); + variable->address = (void*) (base + offset); } else { - variable->address.location = MC_dwarf_get_expression(expr, len); + variable->location = MC_dwarf_get_expression(expr, len); } break; @@ -845,7 +844,7 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D case MC_DW_CLASS_LOCLISTPTR: case MC_DW_CLASS_CONSTANT: // Reference to location list: - variable->address.location = MC_dwarf_get_location_list(die, &attr_location); + variable->location = MC_dwarf_get_location_list(die, &attr_location); break; default: xbt_die("Unexpected calss 0x%x (%i) list for location in <%p>%s", diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index b02b11cac6..c9cb9fdb02 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -162,7 +162,7 @@ void dw_variable_free(dw_variable_t v){ xbt_free(v->name); xbt_free(v->type_origin); if(!v->global) - dw_location_free(v->address.location); + dw_location_free(v->location); xbt_free(v); } } @@ -385,9 +385,9 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a end = cursor - 1; }else{ if(address){ /* global variable */ - if(var_test->address.address == address) + if(var_test->address == address) return -1; - if(var_test->address.address > address) + if(var_test->address > address) end = cursor - 1; else start = cursor + 1; @@ -398,7 +398,7 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a } if(strcmp(var_test->name, var) == 0){ - if(address && var_test->address.address < address) + if(address && var_test->address < address) return cursor+1; else return cursor; @@ -410,7 +410,7 @@ static int MC_dwarf_get_variable_index(xbt_dynar_t variables, char* var, void *a } void MC_dwarf_register_global_variable(mc_object_info_t info, dw_variable_t variable) { - int index = MC_dwarf_get_variable_index(info->global_variables, variable->name, variable->address.address); + int index = MC_dwarf_get_variable_index(info->global_variables, variable->name, variable->address); if (index != -1) xbt_dynar_insert_at(info->global_variables, index, &variable); // TODO, else ? diff --git a/src/mc/mc_hash.c b/src/mc/mc_hash.c index 5bba2ff0d7..4f74676d38 100644 --- a/src/mc/mc_hash.c +++ b/src/mc/mc_hash.c @@ -203,13 +203,13 @@ static void mc_hash_object_globals(mc_hash_t *hash, mc_hashing_state* state, mc_ continue; } - const char* address = variable->address.address; + const char* address = variable->address; bool valid_pointer = (address >= mc_binary_info->start_rw && address <= mc_binary_info->end_rw) || (address >= mc_libsimgrid_info->start_rw && address <= mc_libsimgrid_info->end_rw) || (address >= (const char*) std_heap && address < (const char *)std_heap + STD_HEAP_SIZE); if(!valid_pointer) continue; - mc_hash_value(hash, state, info, variable->address.address, type); + mc_hash_value(hash, state, info, variable->address, type); } } @@ -228,14 +228,14 @@ static void mc_hash_stack_frame( XBT_DEBUG("Hash local variable %s without type", variable->name); continue; } - if(variable->address.location == NULL) { + if(variable->location == NULL) { XBT_DEBUG("Hash local variable %s without location", variable->name); continue; } XBT_DEBUG("Hash local variable %s", variable->name); - void* variable_address = (void*) MC_dwarf_resolve_location(unw_cursor, variable->address.location, frame_pointer); + void* variable_address = (void*) MC_dwarf_resolve_location(unw_cursor, variable->location, frame_pointer); dw_type_t type = xbt_dict_get_or_null(info->types, variable->type_origin); if(type==NULL) { diff --git a/src/mc/mc_private.h b/src/mc/mc_private.h index e561362b43..38de8cc968 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -406,10 +406,11 @@ typedef struct s_dw_variable{ int global; char *name; char *type_origin; - union{ - dw_location_t location; // For global==0 - void *address; // For global!=0 - }address; + + // Use either of: + dw_location_t location; + void* address; + }s_dw_variable_t, *dw_variable_t; typedef struct s_dw_frame{ diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index f9a68ae84a..02f333df67 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -779,7 +779,7 @@ static int compare_heap_area_with_type(void *real_area1, void *real_area2, void switch(type->type){ case DW_TAG_base_type: - if(strcmp(type->name, "char") == 0){ /* String, hence random (arbitrary ?) size */ + if(type->name!=NULL && strcmp(type->name, "char") == 0){ /* String, hence random (arbitrary ?) size */ if(real_area1 == real_area2) return -1; else @@ -1028,7 +1028,7 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, mc_object_ type = type->subtype; } } - if((type->byte_size == DW_TAG_pointer_type) || ((type->type == DW_TAG_base_type) && (!strcmp(type->name, "char")))) + if((type->byte_size == DW_TAG_pointer_type) || ((type->type == DW_TAG_base_type) && type->name!=NULL && (!strcmp(type->name, "char")))) type_size = -1; else type_size = type->byte_size; @@ -1055,7 +1055,7 @@ int compare_heap_area(void *area1, void* area2, xbt_dynar_t previous, mc_object_ } if(type_size != -1){ - if(type_size != heapinfo1[block1].busy_block.busy_size && type_size != heapinfo2[block2].busy_block.busy_size && !strcmp(type->name, "s_smx_context")){ + if(type_size != heapinfo1[block1].busy_block.busy_size && type_size != heapinfo2[block2].busy_block.busy_size && type->name!=NULL && !strcmp(type->name, "s_smx_context")){ if(match_pairs){ match_equals(previous); xbt_dynar_free(&previous);