[DWARF5] Is debug_line.dwo parsing and handling correct in GDB

David Blaikie dblaikie@gmail.com
Tue Jun 22 20:52:57 GMT 2021


On Thu, Jun 17, 2021 at 12:57 AM Tomar, Sourabh Singh <
SourabhSingh.Tomar@amd.com> wrote:

> Hello Everyone,
>
>
>
> Recently while investigating
> https://sourceware.org/bugzilla/show_bug.cgi?id=27966 I stumbled upon the
>
> `.debug_line.dwo (AKA Specialized line table)` parsing part of the GDB.
>
> Glancing over it, it seems like the parsing of the Specialized line
> table(.debug_line.dwo) is limited by the presence of type units.
>
> However apart from type units there are other consumers of
> `.debug_line.dwo` such as `.debug_macro.dwo` for more context on this
>
> front please refer to following DWARFIssue:
> http://dwarfstd.org/ShowIssue.php?issue=200602.1
>
>
>
> Coming back to present situation, the question I have is the
> `.debug_line.dwo` section consumptions is Okay in GDB? If so, Can somebody
>
> provide a possible testing scenario. As of now trunk GCC((GCC) 12.0.0
> 20210514) does not produce type units.
>

For what it's worth: GCC does produce type units, at least so far as I know
- but what you might be hitting is that in DWARFv5 type units are in the
.debug_info[.dwo] section, not the .debug_types[.dwo] section - so the
absence of .debug_types section doesn't mean that type units aren't being
produced. (I don't have a tot gcc build - mine's a little older and doesn't
have some of the recent DWARFv5 work, I guess)

I can't speak for GDB's handling of .debug_line.dwo, though.


> Compilation tried:
>
> $ tot-gcc -fdebug-types-section -g macro.c
>
> $ tot-gcc -fdebug-types-section -gstrict-dwarf macro.c
>
>
>
> If GDB consumption of `.debug_line.dwo` is Okay, then how is it managing
> the primary line table `.debug_line`(containing the address to line
> mapping) part ?
>
> Does it parses the primary line table in a subsequent pass ? or the
> primary line table is parsed first then a second pass needed to accommodate
> information
>
> available in Specialized line table ?
>
>
>
> Please note: CLANG emits Specialized line table iff macro + split mode are
> enabled i.e
>
> ```
>
> $ clang -gdwarf-5 -gsplit-dwarf  -fdebug_macro macro.c
>
> $ llvm-readelf -S macro.dwo | egrep "debug"
>
> *  [ 2] .debug_macro.dwo  PROGBITS        0000000000000000 000040 0004f2
> 00   E  0   0  1*
>
>   [ 3] .debug_str_offsets.dwo PROGBITS   0000000000000000 000532 000580
> 00   E  0   0  1
>
>   [ 4] .debug_str.dwo    PROGBITS        0000000000000000 000ab2 002275 01
> MSE  0   0  1
>
>   [ 5] .debug_info.dwo   PROGBITS        0000000000000000 002d27 00003e
> 00   E  0   0  1
>
>   [ 6] .debug_abbrev.dwo PROGBITS        0000000000000000 002d65 00003f
> 00   E  0   0  1
>
> *  [ 7] .debug_line.dwo   PROGBITS        0000000000000000 002da4 000056
> 00   E  0   0  1*
>
> ```
>
>
>
> Any pointer, much appreciated!
>
>
>
> Thanks,
>
> Sourabh.
>


More information about the Gdb mailing list