Name typedefs
authorbdemsky <bdemsky>
Fri, 30 Sep 2005 05:07:01 +0000 (05:07 +0000)
committerbdemsky <bdemsky>
Fri, 30 Sep 2005 05:07:01 +0000 (05:07 +0000)
Repair/RepairCompiler/structextract/dumpstructures.c
Repair/RepairCompiler/structextract/typedata.c
Repair/RepairCompiler/structextract/typedata.h

index a7bfdf65cfda8b67ceab4f84708f81186201cb3b..01e7d5732f71d6c3799f2dea06d6c79ad7a218c9 100755 (executable)
@@ -520,8 +520,18 @@ char * printname(dwarf_entry * type,int op) {
     {
       tdef * tdef_ptr=(tdef*)type->entry_ptr;
       if (op==GETTYPE||op==GETJUSTTYPE) {
     {
       tdef * tdef_ptr=(tdef*)type->entry_ptr;
       if (op==GETTYPE||op==GETJUSTTYPE) {
-       char *typename=printname(tdef_ptr->target_ptr,op);
-       return typename;
+        if (tdef_ptr->target_ptr==NULL)
+          return tdef_ptr->name;
+        if (tdef_ptr->target_ptr->tag_name==DW_TAG_union_type||
+            tdef_ptr->target_ptr->tag_name==DW_TAG_structure_type) {
+          collection_type *ctype=(collection_type*)tdef_ptr->target_ptr->entry_ptr;
+          if (ctype->name!=NULL)
+            return ctype->name;
+          ctype->name=tdef_ptr->name;
+          return tdef_ptr->name;
+        }
+        char *typename=printname(tdef_ptr->target_ptr,op);
+        return typename;
       }
     }
     break;
       }
     }
     break;
@@ -573,13 +583,13 @@ char * printname(dwarf_entry * type,int op) {
     collection_type *ctype=(collection_type*)type->entry_ptr;
     if (op==GETTYPE&&ctype->name==NULL&&assigntype) {
       ctype->name=(char*)malloc(100);
     collection_type *ctype=(collection_type*)type->entry_ptr;
     if (op==GETTYPE&&ctype->name==NULL&&assigntype) {
       ctype->name=(char*)malloc(100);
-      sprintf(ctype->name,"TYPE%ld",typecount++);
+      sprintf(ctype->name,"unnamed_0x%lx",type->ID);
     }
     if (op==GETTYPE)
       return ctype->name;
     if (op==GETJUSTTYPE&&ctype->name==NULL&&assigntype) {
       ctype->name=(char*)malloc(100);
     }
     if (op==GETTYPE)
       return ctype->name;
     if (op==GETJUSTTYPE&&ctype->name==NULL&&assigntype) {
       ctype->name=(char*)malloc(100);
-      sprintf(ctype->name,"TYPE%ld",typecount++);
+      sprintf(ctype->name,"unnamed_0x%lx",type->ID);
     }
     if (op==GETJUSTTYPE)
       return ctype->name;
     }
     if (op==GETJUSTTYPE)
       return ctype->name;
index cdeae71b673d16a3fe7ab372fef50cf212e01d28..1478fcfa64061a44d46241dc7b94ea2f66496394 100755 (executable)
@@ -202,6 +202,7 @@ char entry_is_listening_for_attribute(dwarf_entry* e, unsigned long attr)
     case DW_AT_name:
       return (tag_is_collection_type(tag) ||
               tag_is_member(tag) ||
     case DW_AT_name:
       return (tag_is_collection_type(tag) ||
               tag_is_member(tag) ||
+             tag==DW_TAG_typedef||
               tag_is_enumerator(tag) ||
               tag_is_function(tag) ||
               tag_is_formal_parameter(tag) ||
               tag_is_enumerator(tag) ||
               tag_is_function(tag) ||
               tag_is_formal_parameter(tag) ||
@@ -439,6 +440,11 @@ char harvest_name(dwarf_entry* e, const char* str)
       ((enumerator*)e->entry_ptr)->name = strdup(str);
       return 1;
     }
       ((enumerator*)e->entry_ptr)->name = strdup(str);
       return 1;
     }
+  else if (tag==DW_TAG_typedef)
+    {
+      ((tdef*)e->entry_ptr)->name = strdup(str);
+      return 1;
+    }
   else if (tag_is_collection_type(tag))
     {
       ((collection_type*)e->entry_ptr)->name = strdup(str);
   else if (tag_is_collection_type(tag))
     {
       ((collection_type*)e->entry_ptr)->name = strdup(str);
index c08cfffb127811ec031dc2870fc24ceadd61f8fa..45e1ef06cb5ff4b09fd6a7b763eadc02f7fca83b 100755 (executable)
@@ -61,26 +61,27 @@ typedef struct
 } modifier_type;
 
 typedef struct
 } modifier_type;
 
 typedef struct
-{ 
+{
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   unsigned long upperbound;
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } array_bound;
 
 typedef struct
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   unsigned long upperbound;
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } array_bound;
 
 typedef struct
-{ 
+{
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
+  char *name;
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } tdef;
 
 typedef struct
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } tdef;
 
 typedef struct
-{ 
+{
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } consttype;
 
 typedef struct
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
 } consttype;
 
 typedef struct
-{ 
+{
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
   long data_member_location; // Addr offset relative to struct head
   unsigned long target_ID; // ID of the entry that contains the type that this modifies
   dwarf_entry* target_ptr; // Type that this entry modifies (DW_AT_type)
   long data_member_location; // Addr offset relative to struct head