aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>2001-12-09 23:17:07 +0000
committerFred Fish <fnf@specifix.com>2001-12-09 23:17:07 +0000
commit2f038fcb08e51676d382e60acb6a9c1a985df635 (patch)
tree00d7c8a1bc1f2c4c73864e146c206413c4d1b5f6 /gdb/dwarf2read.c
parent6251c3aa9e401e7532f4e5e439326a5710ae90f7 (diff)
downloadgdb-2f038fcb08e51676d382e60acb6a9c1a985df635.zip
gdb-2f038fcb08e51676d382e60acb6a9c1a985df635.tar.gz
gdb-2f038fcb08e51676d382e60acb6a9c1a985df635.tar.bz2
Approved by Elena Zannoni:
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index fc149cd..aab1d46 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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);
}
}