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);
// 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){
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) {
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;
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",
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);
}
}
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;
}
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;
}
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 ?
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{