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

mark at klomp dot org sourceware-bugzilla@sourceware.org
Wed May 5 14:36:29 GMT 2021


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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Jim Wilson from comment #1)
> 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.

Any idea where they come from?
And what does it look like when using -gdwarf-5?
You should get a .debug_rnglists section in that case which has explicit end of
list markers (before DWARF5 the double zero addresses are interpreted as end of
list).

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


More information about the Elfutils-devel mailing list