Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Store abstract subprograms in info->subprograms
[simgrid.git] / src / mc / mc_dwarf.c
index 1ee1468..5b8700c 100644 (file)
@@ -452,7 +452,8 @@ static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die* die, Dwarf_Di
   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))
@@ -464,8 +465,10 @@ static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die* die, Dwarf_Di
 
       // 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)
@@ -520,7 +523,7 @@ static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die* die, Dwa
   // Global Offset
   type->id = (void *) dwarf_dieoffset(die);
 
-  char* prefix = "";
+  const char* prefix = "";
   switch (type->type) {
   case DW_TAG_structure_type:
     prefix = "struct ";
@@ -701,17 +704,6 @@ static void MC_dwarf_handle_subprogram_die(mc_object_info_t info, Dwarf_Die* die
   if (MC_dwarf_attr_flag(die, DW_AT_declaration, false))
     return;
 
-  // Abstract inline instance (DW_AT_inline != DW_INL_not_inlined):
-  if (dwarf_func_inline(die))
-    return;
-
-  // This is probably not a concrete instance:
-  // DWARF2/3 and DWARF4 do not agree on the meaning of DW_INL_not_inlined.
-  // For DWARF2/3, the subprogram is abstract.
-  // For DARF4, the subprogram is not abstract.
-  if(!dwarf_hasattr_integrate(die, DW_AT_low_pc))
-    return;
-
   dw_frame_t frame = xbt_new0(s_dw_frame_t, 1);
 
   frame->start = dwarf_dieoffset(die);
@@ -729,13 +721,9 @@ static void MC_dwarf_handle_subprogram_die(mc_object_info_t info, Dwarf_Die* die
   frame->high_pc = ((char*) base) + MC_dwarf_attr_addr(die, DW_AT_high_pc);
   frame->low_pc = ((char*) base) + MC_dwarf_attr_addr(die, DW_AT_low_pc);
 
-  if(frame->high_pc==0 || frame->low_pc==0)
-    xbt_die("Could not resolve highpc/lowpc");
-
   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);
-  mc_dwarf_location_list_init(&frame->frame_base, info, die, &attr_frame_base);
+  if (dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base))
+    mc_dwarf_location_list_init(&frame->frame_base, info, die, &attr_frame_base);
 
   frame->end = -1; // This one is now useless: