[Dwarf-Discuss] Usage of STRP forms in DWO files.

David Blaikie dblaikie@gmail.com
Wed May 20 17:23:54 GMT 2020


my 2c: "If STRP forms are allowed only in DWO files which cannot be
combined into a DWP file, then a packaging utility should be smart enough
to detect such input files and reject them. As there is no simple sign for
that, the tool should analyze sections in input files to check if those
forms are actually used; that parsing will slow down the processing, but it
seems inevitable if we want the tool to be reliable."
That would be too expensive (not the worst - it could be accomplished by
scanning debug_abbrev only - but the point of the dwo/dwp format was to
avoid the packaging tool having to read much of the DWARF at all - index,
str_offsets/strings, and that's basically it).

I think it's probably not worth supporting strp in dwo files. I doubt
either Clang or GCC implement it/ever do that anyway, so probably easy
enough to remove that one sentence from the spec that allows it (& add some
wording to clarify that it's disallowed).

On Wed, May 20, 2020 at 8:26 AM Igor Kudrin via Dwarf-Discuss <
dwarf-discuss at lists.dwarfstd.org> wrote:

> Hi all,
>
> It looks like there is an ambiguity in the DWARF standard concerning using
> STRP forms in DWO files.
>
> On the one hand, they are (conditionally) allowed:
> * Section B.2, fig. B.2, p. 278. There are other arcs to ".debug_str.dwo"
> apart from an arc from ".debug_str_offsets.dwo".
> * Section B.2, p. 279, l. 27-29: "(do) .debug_info.dwo to .debug_str.dwo.
> Attribute values of class string may have form DW_FORM_strp, whose value is
> an offset in the .debug_str.dwo section of the corresponding string."
> * Section F.1, p. 393, l. 1-3: "In a .dwo file, referring to a string
> using DW_FORM_strp is valid, but such use results in a file that cannot be
> incorporated into a package file (which involves string merging)."
>
> On the other hand, they are prohibited:
> * Section F.2.3, p. 403, l. 4-6: "In a split DWARF object file, all
> references to strings go through this table (there are no other offsets to
> .debug_str.dwo in a split DWARF object file). That is, there is no use of
> DW_FORM_strp in a split DWARF object file."
> * Section F.3, p. 409, l. 19-22: "Because all references to these strings
> use form DW_FORM_strx, the packaging utility only needs to adjust the
> string offsets in each .debug_str_offsets.dwo contribution after building
> the new .debug_str.dwo section."
>
> All these excerpts are from informative parts. I cannot find any direct
> allowance or prohibition in normative sections. There is a very indirect
> restriction in section 7.3.5, p. 190, l. 24-26: "The string table section
> in .debug_str.dwo contains all the strings referenced from DWARF attributes
> using any of the forms DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2,
> DW_FORM_strx3 or DW_FORM_strx4." Note that this excerpt does not say
> anything about referencing strings from a .debug_macro.dwo section.
>
> If STRP forms are allowed only in DWO files which cannot be combined into
> a DWP file, then a packaging utility should be smart enough to detect such
> input files and reject them. As there is no simple sign for that, the tool
> should analyze sections in input files to check if those forms are actually
> used; that parsing will slow down the processing, but it seems inevitable
> if we want the tool to be reliable.
>
> I would like to discuss possible ways to avoid that ambiguity in the
> standard. I see the following variants:
>
> 1. Prohibit STRP forms in all DWO files. That would probably be the
> simplest solution, but maybe it is too restrictive.
> 2. Allow only STRP or STRX forms in a DWO file, but not both. In that
> case, a packaging tool can use the absence of a .debug_str_offsets.dwo
> section with a non-empty .desug_str.dwo section as a sign that the input
> file uses STRP forms and easily reject it.
> 3. Allow STRP forms in all DWO files. Consequently, allow STRP forms in
> DWP files. A packaging tool is expected to be smart enough to merge strings
> even from such input files and update references in the corresponding
> sections, not only in .debug_str_offsets.dwo.
>
> Any thoughts?
>
> Best Regards,
> Igor Kudrin
> C++ Developer, Access Softek, Inc.
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20200520/4405a03c/attachment.html>



More information about the Dwarf-discuss mailing list