From: Richard Henderson Date: Tue, 13 Nov 2001 23:37:41 +0000 (+0000) Subject: * dwarf2.c (read_attribute_value): New function to handle X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf716c566378aad45fa09af18d8c2be2e66773a4;p=binutils-gdb.git * dwarf2.c (read_attribute_value): New function to handle DW_FORM_indirect. (read_attribute): Use it. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 164dd2ebccf..d99f9b0fb1a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2001-11-13 Keith Walker + + * dwarf2.c (read_attribute_value): New function to handle + DW_FORM_indirect. + (read_attribute): Use it. + 2001-11-13 Geoffrey Keating * dwarf2.c (decode_line_info): Properly deal with unknown standard diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 209cd8fb991..3a7614d14a2 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -216,6 +216,9 @@ static struct abbrev_info **read_abbrevs static char *read_attribute PARAMS ((struct attribute *, struct attr_abbrev *, struct comp_unit *, char *)); +static char *read_attribute_value + PARAMS ((struct attribute *, unsigned, + struct comp_unit *, char *)); static void add_line_info PARAMS ((struct line_info_table *, bfd_vma, char *, unsigned int, unsigned int, int)); @@ -564,12 +567,12 @@ read_abbrevs (abfd, offset, stash) return abbrevs; } -/* Read an attribute described by an abbreviated attribute. */ +/* Read an attribute value described by an attribute form. */ static char * -read_attribute (attr, abbrev, unit, info_ptr) +read_attribute_value (attr, form, unit, info_ptr) struct attribute *attr; - struct attr_abbrev *abbrev; + unsigned form; struct comp_unit *unit; char *info_ptr; { @@ -578,10 +581,9 @@ read_attribute (attr, abbrev, unit, info_ptr) struct dwarf_block *blk; bfd_size_type amt; - attr->name = abbrev->name; - attr->form = abbrev->form; + attr->form = form; - switch (abbrev->form) + switch (form) { case DW_FORM_addr: case DW_FORM_ref_addr: @@ -676,16 +678,34 @@ read_attribute (attr, abbrev, unit, info_ptr) DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; break; - case DW_FORM_strp: case DW_FORM_indirect: + form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + info_ptr += bytes_read; + info_ptr = read_attribute_value (attr, form, unit, info_ptr); + break; + case DW_FORM_strp: default: (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."), - abbrev->form); + form); bfd_set_error (bfd_error_bad_value); } return info_ptr; } +/* Read an attribute described by an abbreviated attribute. */ + +static char * +read_attribute (attr, abbrev, unit, info_ptr) + struct attribute *attr; + struct attr_abbrev *abbrev; + struct comp_unit *unit; + char *info_ptr; +{ + attr->name = abbrev->name; + info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr); + return info_ptr; +} + /* Source line information table routines. */ #define FILE_ALLOC_CHUNK 5