[Dwarf-discuss] strx use in debug_line table

Mark Wielaard mark@klomp.org
Thu May 16 17:20:21 GMT 2024


Section Standard Content Descriptions under 1. DW_LNCT_path has
the following description on using DW_FORM_strx forms:

   In a .debug_line.dwo section, the forms DW_FORM_strx, DW_FORM_strx1,
   DW_FORM_strx2, DW_FORM_strx3 and DW_FORM_strx4 may also be used.
   These refer into the .debug_str_offsets.dwo section (and indirectly
   also the .debug_str.dwo section) because no
   .debug_line_str_offsets.dwo or .debug_line_str.dwo sections exist or
   are defined for use in split objects.
This confuses me a little, it is as if the strx forms are only allowed
when generating split dwarf. But that doesn't seem to be the intent,
because under Vendor-defined Content Descriptions all DW_FORM_strx
variants are listed without special exceptions.

So I assume the description under DW_LNCT_path is just to explain that
there isn't a .debug_line_str_offsets section that the DW_FORM_strx
forms can refer to. And that DW_FORM_strx forms are resolved as normal
and can be used in both .debug_line and .debug_line.dwo content

This leaves the question how to determine the str_offsets_base to use.
This seems to require to lookup the CU DIE(s) that refers to the line
table and see if one of them has a DW_AT_str_offsets_base.

While this is possible, it isn't very efficient when just parsing the
.debug_line table itself.

Would it make sense to add the str_offsets_base to the line table
header (for DWARF6)?

Or am I missing a better/simpler way to handle DW_FORM_strx in
.debug_line tables? Or maybe using DW_FORM_strx forms in the
.debug_line table is not something that is really done (I haven't
actually found any producer which does).



More information about the Dwarf-discuss mailing list