https://sourceware.org/bugzilla/show_bug.cgi?id=32110

--- Comment #12 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Claudiu Zissulescu
<[email protected]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=379969541f562a2b09639097535bab155b3611e8

commit 379969541f562a2b09639097535bab155b3611e8
Author: Claudiu Zissulescu <[email protected]>
Date:   Wed Nov 18 18:00:18 2026 +0000

    gprofng: Resolve DWARF 5 indexed string and address forms

    Clang emits DW_FORM_strx* and DW_FORM_addrx* by default for DWARF 5.
    gprofng used the strx index as a byte offset into .debug_str and kept
    the addrx index as the address, so compilation unit names, directories
    and every PC range were wrong.  "gprofng display text -lines" then
    showed "<Function: ..., instructions without line numbers>" and
    "-source" failed with "Source location not recorded in experiment".
    GCC does not use the indexed forms and was not affected.

    This is a follow-up to PR 32110.  That fix made DW_FORM_strx* stop
    crashing, but it treated the index as an offset into .debug_str, which
    yields wrong strings.

    Read .debug_str_offsets and .debug_addr.  The string and address
    indices are resolved through DW_AT_str_offsets_base and
    DW_AT_addr_base.  Clang emits those two attributes after the ones that
    use them, so queue the indexed attributes while reading a DIE and
    resolve them once the whole DIE has been read.  An index that cannot
    be resolved gives NULL or 0, as before.

    Also accept the addrx forms in Dwarf_addr and get_high_pc.

            * src/Dwarf.h (Dwarf): Add debug_str_offsetsSec and debug_addrSec.
            * src/Dwarf.cc (Dwarf::Dwarf): Load .debug_str_offsets and
            .debug_addr.
            * src/DwarfLib.h (DwrCU): Add str_offsets_base, addr_base,
            get_indexed_string and get_indexed_addr.
            * src/DwarfLib.cc (DwrCU::DwrCU): Initialize the new members.
            (DwrCU::set_die): Record DW_AT_str_offsets_base and
            DW_AT_addr_base.  Keep only the raw index for DW_FORM_strx* and
            DW_FORM_addrx*, and resolve it after the DIE has been read.
            (DwrCU::get_indexed_string, DwrCU::get_indexed_addr): New.
            (DwrCU::Dwarf_addr, DwrCU::get_high_pc): Handle DW_FORM_addrx*.
            (Dwr_Tag::dump): Print DW_FORM_strx as a string.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to