[PATCH] D39854: [DWARFv5] Support FORM_strp in .debug_line.dwo

Robinson, Paul via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 16:46:31 PST 2017


In fact, for dumping a .debug_line.dwo, the unit should *not* be needed.  A .dwo doesn't have any addresses in it, and won't be v2, so all it needs to know is the 32/64 format, which is in the line-table header.

Hmm, so why do we pass in the pointer size to it at all? Guess that should be fixed.

Well, true.  It needs a minor tweak to an assertion but for .dwo we don't need to pass it.

Could you summarize any of the issues you hit trying to move the string section handles out of the DWARFUnit? I'd have thought they could readily go into (or already be present in) the DWARFContext?

They are not in DWARFContext currently, although they can be retrieved from the DWARFObject and DWARFContext has a handle on the DWARFObject.

One problem is that you have both normal and DWO string sections, and the DWARFUnit constructor was handed the relevant one, which means it's just "the string section" from the unit's perspective.  When the line table parser has the appropriate unit, there are no decisions left to make; FORM_strp points to "the string section," end of story.  If the line table parser has the context instead of the unit, and we want it to pick the right string section, the parser then has to know whether it's a normal or DWO line table.  The line tables themselves don't know this about themselves, so the caller has to tell the parser up front.

And, when we're trying to extract a string (e.g. a pathname), the line-table parser defers to DWARFFormValue, which is expecting… a unit.  Because, for some forms, DWARFFormValue actually does need the unit (which normally it would have, because normally it's decoding a unit, not a line table).  And when the line-table parser wants to extract the string for a pathname, it doesn't want to be deciding which FormValue API to use (one that takes a unit, or one that doesn't) based on the form; the line-table parser doesn't want to know about forms at all.  That's what FormValue is for!  But, if the line-table header was produced using DW_FORM_strx, then the line-table parser really does need the actual unit, because FORM_strx is relative to a base offset in the compile unit.  Or at least, the parser needs string info that is aware of the base offset that came from the unit.

So, yes, sometimes we don't need the unit in order to decode the line table, or at least the line table header.  But sometimes we do, depending on decisions made by the producer, and sometimes we do, because it simplifies the class APIs when somebody higher up the chain has packaged all the right stuff into one place.  Somewhere in there I can imagine there's an API that splits out the appropriate string info, just like FormParams got split out, without making life miserable for all the callers; but I haven't found it yet.

--paulr
Who hopes this doesn't come across as all whiny.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/86462ce2/attachment.html>


More information about the llvm-commits mailing list