[PATCH 8/9] Fix the decoding of DW_FORM_ref_addr DWARF attribute.

H.J. Lu hjl.tools@gmail.com
Sun Nov 15 17:29:36 GMT 2020


On Sun, Nov 15, 2020 at 9:03 AM Mark Wielaard <mark@klomp.org> wrote:
>
> From: Nick Clifton <nickc@redhat.com>
>
>         * dwarf.c (struct abbrev_list): New structure.  Used to collect
>         lists of abbreviation sets.
>         (struct abbrev_map): New structure.  Used to map CU offsets to
>         abbreviation offsets.
>         (record_abbrev_list): New function.  A new entry to an
>         abbreviation list.
>         (free_all_abbrevs): Update to free abbreviation lists.
>         (new_abbrev_list): New function.  Start a new abbreviation
>         list.
>         (find_abbrev_list_by_abbrev_offset): New function.
>         (find_abbrev_map_by_offset): New function.
>         (add_abbrev): Add abbrev_list parameter.
>         (add_abbrev_attr): Likewise.
>         (process_abbrev_section): Rename to process_abbrev_set and add
>         list parameter.
>         (get_type_abbrev_from_form): New function.  Attempts to decode the
>         forms used by DW_AT_type attributes.
>         (get_type_signedness): Display type names if operating in wide
>         mode.  Use get_type_abbrev_from_form.
>         (read_and_display_attr_value): Use get_type_abbrev_from_form.
>         (process_debug_info): Pre-parse the CU headers to collate all the
>         abbrevs before starting the main scan.
>         (process_debug_abbrev): Do not free any loaded abbrevs.
>         (free_debug_memory): Free the abbrev maps.
>
> (cherry picked from commit bcd213b2cfbca2df53fb7e5d187fd67ea8eb7185)
> ---
>  binutils/ChangeLog |  30 +++
>  binutils/dwarf.c   | 585 ++++++++++++++++++++++++++++++++++-----------
>  2 files changed, 477 insertions(+), 138 deletions(-)
>

I think you also need to backport:

commit 76868f3606fb9de04f49c441c1e3cdd3e943a34d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Oct 29 09:19:25 2020 -0700

    dwarf: Also match abbrev base when searching abbrev list

    A .debug_abbrev section can have multiple CUs.  When caching abbrev list,
    we need to check abbrev base to support multiple CUs.

            PR binutils/26808
            * dwarf.c (abbrev_list): Add abbrev_base.
            (new_abbrev_list): Add an abbrev_base argument and record it.
            (find_abbrev_list_by_abbrev_offset): Add an abbrev_base argument
            and match it.
            (process_debug_info): Pass abbrev_base to new_abbrev_list and
            find_abbrev_list_by_abbrev_offset.
            (display_debug_abbrev): Pass 0 abbrev_base to new_abbrev_list
            and find_abbrev_list_by_abbrev_offset.
            * testsuite/binutils-all/x86-64/pr26808.dump: New file.
            * testsuite/binutils-all/x86-64/pr26808.dwp.bz2: Likewise.
            * testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/26808
            test.

-- 
H.J.


More information about the Binutils mailing list