* dwarf2.c (read_attribute_value): New function to handle

DW_FORM_indirect.
        (read_attribute): Use it.
This commit is contained in:
Richard Henderson
2001-11-13 23:37:41 +00:00
parent 81766fcaa8
commit cf716c5663
2 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2001-11-13 Keith Walker <keith.walker@arm.com>
* dwarf2.c (read_attribute_value): New function to handle
DW_FORM_indirect.
(read_attribute): Use it.
2001-11-13 Geoffrey Keating <geoffk@redhat.com> 2001-11-13 Geoffrey Keating <geoffk@redhat.com>
* dwarf2.c (decode_line_info): Properly deal with unknown standard * dwarf2.c (decode_line_info): Properly deal with unknown standard

View File

@ -216,6 +216,9 @@ static struct abbrev_info **read_abbrevs
static char *read_attribute static char *read_attribute
PARAMS ((struct attribute *, struct attr_abbrev *, PARAMS ((struct attribute *, struct attr_abbrev *,
struct comp_unit *, char *)); struct comp_unit *, char *));
static char *read_attribute_value
PARAMS ((struct attribute *, unsigned,
struct comp_unit *, char *));
static void add_line_info static void add_line_info
PARAMS ((struct line_info_table *, bfd_vma, char *, PARAMS ((struct line_info_table *, bfd_vma, char *,
unsigned int, unsigned int, int)); unsigned int, unsigned int, int));
@ -564,12 +567,12 @@ read_abbrevs (abfd, offset, stash)
return abbrevs; return abbrevs;
} }
/* Read an attribute described by an abbreviated attribute. */ /* Read an attribute value described by an attribute form. */
static char * static char *
read_attribute (attr, abbrev, unit, info_ptr) read_attribute_value (attr, form, unit, info_ptr)
struct attribute *attr; struct attribute *attr;
struct attr_abbrev *abbrev; unsigned form;
struct comp_unit *unit; struct comp_unit *unit;
char *info_ptr; char *info_ptr;
{ {
@ -578,10 +581,9 @@ read_attribute (attr, abbrev, unit, info_ptr)
struct dwarf_block *blk; struct dwarf_block *blk;
bfd_size_type amt; bfd_size_type amt;
attr->name = abbrev->name; attr->form = form;
attr->form = abbrev->form;
switch (abbrev->form) switch (form)
{ {
case DW_FORM_addr: case DW_FORM_addr:
case DW_FORM_ref_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); DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read; info_ptr += bytes_read;
break; break;
case DW_FORM_strp:
case DW_FORM_indirect: 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: default:
(*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."), (*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."),
abbrev->form); form);
bfd_set_error (bfd_error_bad_value); bfd_set_error (bfd_error_bad_value);
} }
return info_ptr; 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. */ /* Source line information table routines. */
#define FILE_ALLOC_CHUNK 5 #define FILE_ALLOC_CHUNK 5