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

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Indu Bhagat <ibha...@sourceware.org>:

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

commit c915c2c95a3b38749d5a2f455ad5c91a20cb4794
Author: Indu Bhagat <indu.bha...@oracle.com>
Date:   Sun Jul 6 12:46:53 2025 -0700

    objdump, readelf: sframe: apply relocations before textual dump

    PR libsframe/32589 - function start address is zero in SFrame section dump

    Currently, readelf and objdump display the SFrame sections in ET_REL
    object files with function start addresses of each function as 0.  This
    makes it difficult to correlate SFrame stack trace information with the
    individual functions in the object file.

    For objdump, use the dump_dwarf () interface to dump SFrame section.
    Similarly, for readelf, use the display_debug_section () interface to
    dump SFrame section.  These existing interfaces (for DWARF debug
    sections) already support relocating the section contents before
    dumping, so lets use them for SFrame sections as well.

    When adding a new entry for SFrame in debug_option_table[], use char
    'nil' and the option name of "sframe-internal-only".  This is done so
    that there is no additional (unnecessary) user-exposed ways of dumping
    SFrame sections.  Additionally, we explicitly disallow the
    "sframe-internal-only" from external/user input in --dwarf (objdump).
    Similarly, "sframe-internal-only" is explicitly matched and disallowed
    from --debug-dump (readelf).

    For objdump and readelf, we continue to keep the same error messaging as
    earlier:

      $ objdump --sframe=sframe bubble_sort.o
      ...
      No sframe section present

      $ objdump --sframe=.sfram bubble_sort.o
      ...
      No .sfram section present

      $ objdump --sframe=sframe-internal-only sort
      ...
      No sframe-internal-only section present

    Similarly for readelf:

      $ readelf --sframe= bubble_sort.o
      readelf: Error: Section name must be provided
      $ readelf --sframe=.sfram bubble_sort.o
      readelf: Warning: Section '.sfram' was not dumped because it does not
exist
      $ readelf --sframe=sframe bubble_sort.o
      readelf: Warning: Section 'sframe' was not dumped because it does not
exist

    PS: Note how this patch adds a new entry to debug_displays[] with a
        relocate value set to FALSE.  This will be set to TRUE in a subsequent
        patch ("bfd: gas: ld: libsframe: emit func start addr field as an
offset
        from FDE") when fixes are made to emit the value of the
        'sfde_func_start_address' field in the new encoding
        SFRAME_F_FDE_FUNC_START_PCREL across gas and ld.

    binutils/
            * dwarf.c (display_sframe): New definition.
            (dwarf_select_sections_all): Enable SFrame section too.
            (struct dwarf_section_display): Add entry for SFrame section.
            * dwarf.h (enum dwarf_section_display_enum): Add enumerator for
            SFrame.
            * objdump.c (dump_section_sframe): Remove.
            (dump_sframe_section): Add new definition.
            (dump_bfd): Use dump_sframe_section.
            * binutils/readelf.c (dump_section_as_sframe): Remove.

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

Reply via email to