+2005-01-05 Fred Fish <fnf@specifixinc.com>
+
+ * dwarf2.c (struct dwarf2_debug): Add info_ptr_unit member.
+ (find_abstract_instance_name): New function.
+ (scan_unit_for_functions): Handle DW_TAG_inlined_subroutine.
+ (scan_unit_for_functions): Handle DW_AT_abstract_origin.
+ (_bfd_dwarf2_find_nearest_line): Initialize info_ptr_unit.
+
2004-12-31 Paul Brook <paul@copdesourcery.com>
* elf32-arm.c (elf32_arm_symbian_plt_entry): Fix comment typo.
into a buffer yet. */
char* info_ptr;
+ /* Preserve the original value of info_ptr for the current
+ comp_unit so we can find a given entry by its reference. */
+ char* info_ptr_unit;
+
/* Pointer to the end of the .debug_info section memory buffer. */
char* info_ptr_end;
return FALSE;
}
+static char *
+find_abstract_instance_name (struct comp_unit *unit, bfd_uint64_t die_ref)
+{
+ bfd *abfd = unit->abfd;
+ char *info_ptr;
+ unsigned int abbrev_number, bytes_read, i;
+ struct abbrev_info *abbrev;
+ struct attribute attr;
+ char *name = 0;
+
+ info_ptr = unit->stash->info_ptr_unit + die_ref;
+ abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ info_ptr += bytes_read;
+
+ if (abbrev_number)
+ {
+ abbrev = lookup_abbrev (abbrev_number, unit->abbrevs);
+ if (! abbrev)
+ {
+ (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."),
+ abbrev_number);
+ bfd_set_error (bfd_error_bad_value);
+ }
+ else
+ {
+ for (i = 0; i < abbrev->num_attrs && !name; ++i)
+ {
+ info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
+ if (attr.name == DW_AT_name)
+ name = attr.u.str;
+ }
+ }
+ }
+ return (name);
+}
+
/* DWARF2 Compilation unit functions. */
/* Scan over each die in a comp. unit looking for functions to add
return FALSE;
}
- if (abbrev->tag == DW_TAG_subprogram)
+ if (abbrev->tag == DW_TAG_subprogram
+ || abbrev->tag == DW_TAG_inlined_subroutine)
{
bfd_size_type amt = sizeof (struct funcinfo);
func = bfd_zalloc (abfd, amt);
{
switch (attr.name)
{
+ case DW_AT_abstract_origin:
+ func->name = find_abstract_instance_name (unit, attr.u.val);
+ break;
+
case DW_AT_name:
name = attr.u.str;
if (stash->info_ptr == NULL)
return FALSE;
+ stash->info_ptr_unit = stash->info_ptr;
stash->info_ptr_end = stash->info_ptr;
for (msec = find_debug_info (abfd, NULL);