X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/296031c0d105d287c2c9d5411dafa9b0e05651d9..57d96d2cf3a593395ef6657f07c06b57dcdac400:/src/mc/mc_dwarf.c diff --git a/src/mc/mc_dwarf.c b/src/mc/mc_dwarf.c index eaff170fa6..5839708020 100644 --- a/src/mc/mc_dwarf.c +++ b/src/mc/mc_dwarf.c @@ -795,6 +795,8 @@ static dw_location_t MC_dwarf_get_expression(Dwarf_Op* expr, size_t len) { return loc; } +static int mc_anonymous_variable_index = 0; + static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, Dwarf_Die* unit, dw_frame_t frame) { // Drop declaration: if (MC_dwarf_attr_flag(die, DW_AT_declaration, false)) @@ -811,7 +813,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) { @@ -831,10 +832,10 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D variable->global = 1; 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_text : 0; - variable->address.address = (void*) (base + offset); + Dwarf_Off base = strcmp(info->file_name, xbt_binary_name) !=0 ? (Dwarf_Off) info->start_exec : 0; + 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,13 +843,19 @@ 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", klass, klass, (void*) variable->dwarf_offset, variable->name); } + // The current code needs a variable name, + // generate a fake one: + if(!variable->name) { + variable->name = bprintf("@anonymous#%i", mc_anonymous_variable_index++); + } + return variable; }