Approved by Elena Zannoni:
authorFred Fish <fnf@specifix.com>
Sun, 9 Dec 2001 23:17:07 +0000 (23:17 +0000)
committerFred Fish <fnf@specifix.com>
Sun, 9 Dec 2001 23:17:07 +0000 (23:17 +0000)
2001-12-08  Fred Fish  <fnf@redhat.com>
* dwarf2read.c (read_typedef):  Replace hand crafted type
initialization with a call to the init_type() function, which
is how the rest of gdb creates types.

gdb/ChangeLog
gdb/dwarf2read.c

index e96158f783cbbdf49a6cc5bbd4c9f8861d1be7b2..cfac5d13c008282cb499ac74149e6a44572e70d7 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-08  Fred Fish  <fnf@redhat.com>
+
+       * dwarf2read.c (read_typedef):  Replace hand crafted type
+       initialization with a call to the init_type() function, which
+       is how the rest of gdb creates types.
+
 2001-12-09  Fred Fish  <fnf@redhat.com>
 
        * mdebugread.c (cross_ref): Pass TYPE_FLAG_STUB to init_type()
index fc149cde7992975c4225eccfffde80bc5f62784a..aab1d46676b559c455ead48bc87fc20941e6aee0 100644 (file)
@@ -2882,26 +2882,18 @@ static void
 read_typedef (struct die_info *die, struct objfile *objfile,
              const struct comp_unit_head *cu_header)
 {
-  struct type *type;
+  struct attribute *attr;
+  char *name = NULL;
 
   if (!die->type)
     {
-      struct attribute *attr;
-      struct type *xtype;
-
-      xtype = die_type (die, objfile, cu_header);
-
-      type = alloc_type (objfile);
-      TYPE_CODE (type) = TYPE_CODE_TYPEDEF;
-      TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
-      TYPE_TARGET_TYPE (type) = xtype;
       attr = dwarf_attr (die, DW_AT_name);
       if (attr && DW_STRING (attr))
-       TYPE_NAME (type) = obsavestring (DW_STRING (attr),
-                                        strlen (DW_STRING (attr)),
-                                        &objfile->type_obstack);
-
-      die->type = type;
+       {
+         name = DW_STRING (attr);
+       }
+      die->type = init_type (TYPE_CODE_TYPEDEF, 0, TYPE_FLAG_TARGET_STUB, name, objfile);
+      TYPE_TARGET_TYPE (die->type) = die_type (die, objfile, cu_header);
     }
 }