aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-01-28 13:43:35 +0000
committerNick Clifton <nickc@redhat.com>2014-01-28 13:43:35 +0000
commit0a9c7b2bf1903322a9b03d76c9c171bcd2ad3cf0 (patch)
tree179e64797ca4e4dee2e79387285665f47747af74 /bfd/dwarf2.c
parent342df9df2426b93b1b218848224a26f387c37ecd (diff)
downloadgdb-0a9c7b2bf1903322a9b03d76c9c171bcd2ad3cf0.zip
gdb-0a9c7b2bf1903322a9b03d76c9c171bcd2ad3cf0.tar.gz
gdb-0a9c7b2bf1903322a9b03d76c9c171bcd2ad3cf0.tar.bz2
When parsing a DW_FORM_ref_addr attribute the CU containing the
abbreviation may not be the current CU. Thus we need to make sure that when we read the abbreviation we use the correct CU. * dwarf2.c (find_abstract_instance_name): For DW_FORM_ref_addr attributes select the CU containing the abbreviation, which may not be the current CU.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 4a904ea..43d4c1d 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2128,6 +2128,28 @@ find_abstract_instance_name (struct comp_unit *unit,
abort ();
info_ptr = unit->sec_info_ptr + die_ref;
+
+ /* Now find the CU containing this pointer. */
+ if (info_ptr >= unit->info_ptr_unit && info_ptr < unit->end_ptr)
+ ;
+ else
+ {
+ /* Check other CUs to see if they contain the abbrev. */
+ struct comp_unit * u;
+
+ for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
+ if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
+ break;
+
+ if (u == NULL)
+ for (u = unit->next_unit; u != NULL; u = u->next_unit)
+ if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
+ break;
+
+ if (u)
+ unit = u;
+ /* else FIXME: What do we do now ? */
+ }
}
else if (attr_ptr->form == DW_FORM_GNU_ref_alt)
{
@@ -2139,6 +2161,8 @@ find_abstract_instance_name (struct comp_unit *unit,
bfd_set_error (bfd_error_bad_value);
return name;
}
+ /* FIXME: Do we need to locate the correct CU, in a similar
+ fashion to the code in the DW_FORM_ref_addr case above ? */
}
else
info_ptr = unit->info_ptr_unit + die_ref;