diff options
author | Jason Merrill <jason@redhat.com> | 1996-10-07 17:18:24 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 1996-10-07 17:18:24 +0000 |
commit | e61a754e396df151e55b22c2d0277258e0ec0e1d (patch) | |
tree | 7e4307e76e6645333d0103759d21d4839a1feca3 /gdb/dwarf2read.c | |
parent | 1233f74bc41356b488ef915a5fe028cf962f1fa3 (diff) | |
download | gdb-e61a754e396df151e55b22c2d0277258e0ec0e1d.zip gdb-e61a754e396df151e55b22c2d0277258e0ec0e1d.tar.gz gdb-e61a754e396df151e55b22c2d0277258e0ec0e1d.tar.bz2 |
Sun Oct 6 22:43:06 1996 Jason Merrill <jason@yorick.cygnus.com>
* dwarf2read.c (read_tag_reference_type): New fn.
(read_type_die): Call it.
(dwarf_attr): Also look in the DIEs referred to by specification
or abstract_origin attributes.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index f0f008b..1dfcfe3 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1728,6 +1728,43 @@ read_tag_pointer_type (die, objfile) die->type = type; } +/* Extract all information from a DW_TAG_reference_type DIE and add to + the user defined type vector. */ + +static void +read_tag_reference_type (die, objfile) + struct die_info *die; + struct objfile *objfile; +{ + struct type *type, *pointed_to_type; + struct attribute *attr; + + if (die->type) + { + return; + } + + pointed_to_type = die_type (die, objfile); + + type = dwarf_alloc_type (objfile); + TYPE_TARGET_TYPE (type) = pointed_to_type; + TYPE_OBJFILE (type) = objfile; + attr = dwarf_attr (die, DW_AT_byte_size); + if (attr) + { + TYPE_LENGTH (type) = DW_UNSND (attr); + } + else + { + TYPE_LENGTH (type) = address_size; + } + TYPE_CODE (type) = TYPE_CODE_REF; + TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; + + TYPE_REFERENCE_TYPE (pointed_to_type) = type; + die->type = type; +} + static void read_tag_const_type (die, objfile) struct die_info *die; @@ -2637,6 +2674,7 @@ dwarf_attr (die, name) unsigned int name; { unsigned int i; + struct attribute *spec = NULL; for (i = 0; i < die->num_attrs; ++i) { @@ -2644,7 +2682,13 @@ dwarf_attr (die, name) { return &die->attrs[i]; } + if (die->attrs[i].name == DW_AT_specification + || die->attrs[i].name == DW_AT_abstract_origin) + spec = &die->attrs[i]; } + if (spec) + return dwarf_attr (follow_die_ref (DW_UNSND (spec)), name); + return NULL; } @@ -3122,6 +3166,9 @@ read_type_die (die, objfile) case DW_TAG_pointer_type: read_tag_pointer_type (die, objfile); break; + case DW_TAG_reference_type: + read_tag_reference_type (die, objfile); + break; case DW_TAG_const_type: read_tag_const_type (die, objfile); break; |