From e63ef0954d02bec8ecb9cf7ff9fc14adc45e8010 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 2 Dec 2019 23:37:34 +1030 Subject: PR25230, addr2line fails on dwz output This patch remedies the following DW_FORM_GNU_ref_alt related problem: /* FIXME: Do we need to locate the correct CU, in a similar fashion to the code in the DW_FORM_ref_addr case above ? */ Without the correct CU the wrong abbrevs are used, resulting in errors and/or wrong file names. There is scope for further work here. Parsing of CUs should be a two step process, with the first stage just finding the bounds of the CU. This would allow find_abstract_instance to quickly find the CU referenced by DW_FORM_ref_addr or DW_FORM_GNU_ref_alt, then take the second stage of CU parsing where abbrevs, ranges and suchlike consume time and memory. As it is, we just process CUs from the start of .debug_info until we find the one of interest. The testcase in the PR takes 98G of virtual memory. PR 25230 * dwarf2.c (struct dwarf2_debug_file): Add line_table and abbrev_offsets. (struct abbrev_offset_entry): New. (hash_abbrev, eq_abbrev, del_abbrev): New functions. (read_abbrevs): Check whether we have already read abbrevs at given offset, and add new offset/abbrev to hash table. (decode_line_info): Keep line table at offset zero in file struct. Return this for a cu reusing the same dir/file list. (find_abstract_instance): Find cu for DW_FORM_GNU_ref_alt. (_bfd_dwarf2_slurp_debug_info): Create offset/abbrev hash tables. (_bfd_dwarf2_cleanup_debug_info): Adjust deletion of lines and abbrevs. --- bfd/ChangeLog | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bfd/ChangeLog') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 02b744e..02c39fa 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,22 @@ 2019-12-03 Alan Modra PR 25230 + * dwarf2.c (struct dwarf2_debug_file): Add line_table and + abbrev_offsets. + (struct abbrev_offset_entry): New. + (hash_abbrev, eq_abbrev, del_abbrev): New functions. + (read_abbrevs): Check whether we have already read abbrevs at + given offset, and add new offset/abbrev to hash table. + (decode_line_info): Keep line table at offset zero in file struct. + Return this for a cu reusing the same dir/file list. + (find_abstract_instance): Find cu for DW_FORM_GNU_ref_alt. + (_bfd_dwarf2_slurp_debug_info): Create offset/abbrev hash tables. + (_bfd_dwarf2_cleanup_debug_info): Adjust deletion of lines and + abbrevs. + +2019-12-03 Alan Modra + + PR 25230 * dwarf2.c (struct dwarf2_debug_file): New struct. (struct dwarf2_debug): Delete fields now in dwarf2_debug_file. Add f, alt fields. -- cgit v1.1