From: Gabriel Corona Date: Fri, 7 Feb 2014 11:45:28 +0000 (+0100) Subject: [mc] Split address/location in dw_variable_t (which were in a union) X-Git-Tag: v3_11~199^2~2^2~26^2~3 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7db2327a25dd339d72e5be32a44190d3b2191577 [mc] Split address/location in dw_variable_t (which were in a union) --- diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index d2efa6ef70..7e8d185ca7 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -475,8 +475,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 6dda53aa55..9543f096ae 100644 --- a/src/mc/mc_compare.c +++ b/src/mc/mc_compare.c @@ -285,11 +285,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; res = compare_areas_with_type((char *)r1->data + offset, (char *)r2->data + offset, types, other_types, current_var->type_origin, r1->size, region_type, start_data, 0); if(res == 1){ diff --git a/src/mc/mc_dwarf.c b/src/mc/mc_dwarf.c index 84747d0409..84e42607ce 100644 --- a/src/mc/mc_dwarf.c +++ b/src/mc/mc_dwarf.c @@ -811,7 +811,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) { @@ -832,9 +831,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; @@ -842,7 +841,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 b3cc8baac2..e0a8bddb6a 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -164,7 +164,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_private.h b/src/mc/mc_private.h index 85ef10f74f..206d531754 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -410,10 +410,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{