[Bug libdw/27805] libdwfl: Unable to extract source line information for RISC-V binary

wilson at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Sat May 1 20:48:57 GMT 2021


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

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu.org

--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
Using readelf -wr to look at the debug_aranges section, I see entries like

  Length:                   44
  Version:                  2
  Offset into .debug_info:  0x987
  Pointer Size:             4
  Segment Size:             0

    Address    Length
    00000000 00000000
    20400132 00000002
    20400134 0000003a
    00000000 00000000

An address/length entry of 0/0 is supposed to mark the end of the list, but
here we have one at the beginning.  This is confusing elfutils which is trying
to move byte by byte through the aranges section. libdw/dwarf_aranges.c has
          /* Two zero values mark the end.  */
          if (range_address == 0 && range_length == 0)
            break;
and then assumes that the next entry is immediately following, which it isn't,
and it ends up reading garbage.  binutils seems to be using the length field to
find the last entry.  And readelf is ignoring the 0/0 end of list rule so that
we can see the invalid entries.

There are a lot of aranges that have 0/0 entries not at the end of the list.

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


More information about the Elfutils-devel mailing list