PR25230, addr2line fails on dwz output
authorAlan Modra <amodra@gmail.com>
Mon, 2 Dec 2019 13:07:34 +0000 (23:37 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Dec 2019 07:00:58 +0000 (17:30 +1030)
commite63ef0954d02bec8ecb9cf7ff9fc14adc45e8010
tree822465f1f6143252a0c4104d52f1c82483bc6abd
parent99b06c600f0f5cb730cbdab9c3bb8b1f9317e0a1
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
bfd/dwarf2.c
This page took 0.024087 seconds and 4 git commands to generate.