if (len==1 && expr[0].atom == DW_OP_plus_uconst) {
member->offset = expr[0].number;
} else {
- xbt_die("Can't groke this location expression yet.");
+ mc_dwarf_expression_init(&member->location, len, expr);
}
break;
}
xbt_assert(!type->members);
type->members = xbt_dynar_new(sizeof(dw_type_t), (void(*)(void*))dw_type_free);
for (res=dwarf_child(die, &child); res==0; res=dwarf_siblingof(&child,&child)) {
- if (dwarf_tag(&child)==DW_TAG_member) {
+ int tag = dwarf_tag(&child);
+ if (tag==DW_TAG_member || tag==DW_TAG_inheritance) {
// Skip declarations:
if (MC_dwarf_attr_flag(&child, DW_AT_declaration, false))
// TODO, we should use another type (because is is not a type but a member)
dw_type_t member = xbt_new0(s_dw_type_t, 1);
- member->type = -1;
- member->id = NULL;
+ member->type = tag;
+
+ // Global Offset:
+ member->id = (void *) dwarf_dieoffset(&child);
const char* name = MC_dwarf_attr_string(&child, DW_AT_name);
if(name)
// Global Offset
type->id = (void *) dwarf_dieoffset(die);
+ const char* prefix = "";
+ switch (type->type) {
+ case DW_TAG_structure_type:
+ prefix = "struct ";
+ break;
+ case DW_TAG_union_type:
+ prefix = "union ";
+ break;
+ case DW_TAG_class_type:
+ prefix = "class ";
+ break;
+ default:
+ prefix = "";
+ }
+
const char* name = MC_dwarf_attr_string(die, DW_AT_name);
if (name!=NULL) {
- type->name = xbt_strdup(name);
+ type->name = namespace ? bprintf("%s%s::%s", prefix, namespace, name) : bprintf("%s%s", prefix, name);
}
XBT_DEBUG("Processing type <%p>%s", type->id, type->name);
case DW_TAG_class_type:
MC_dwarf_add_members(info, die, unit, type);
char* new_namespace = namespace == NULL ? xbt_strdup(type->name)
- : bprintf("%s::%s", namespace, type->name);
+ : bprintf("%s::%s", namespace, name);
MC_dwarf_handle_children(info, die, unit, frame, new_namespace);
free(new_namespace);
break;
xbt_dict_set(info->types, key, type, NULL);
if(type->name && type->byte_size!=0) {
- xbt_dict_set(info->types_by_name, type->name, type, NULL);
+ xbt_dict_set(info->full_types_by_name, type->name, type, NULL);
}
}
Dwarf_Attribute attr_frame_base;
if (!dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base))
- xbt_die("Coult not find DW_AT_frame_base for subprogram %s %p", frame->name, frame->start);
+ xbt_die("Coult not find DW_AT_frame_base for subprogram %s 0x%lx", frame->name, frame->start);
mc_dwarf_location_list_init(&frame->frame_base, info, die, &attr_frame_base);
frame->end = -1; // This one is now useless: