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

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 14:57:41 PST 2017


probinson added a comment.

(Moving the why-do-we-need-the-unit discussion out of the inline comments.)

I do have a goal of being able to handle a line table without a unit, when possible.  However, there are constraints, and many times you still end up needing a unit.  Sadly, the caller of the line-table parser doesn't know whether the unit will be needed.

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.  However, because of how libDebugInfo works, the string-section handles are in DWARFUnit.  So, for a v5 line-table header that uses any indirect string form, the parser still needs the DWARFUnit even though it doesn't need the .debug_info compile/type unit.  I tilted at that windmill several times, and the windmill won every time.

If we defer looking up the unit until the line-table parser needs to know it, then the parser will frequently end up doing the linear scan through the units until it finds the right one (O(N*N/2)).  It seemed less inefficient to scan all the units once and do a map lookup each time instead (O(N+NlogN)).  I am guessing it will be unusual for a line table *not* to need the unit, so the unconditional lookup seemed like the better choice.  And the parser doesn't know whether it should search the normal or .dwo CUs, so.... might as well just do it up front in the caller.

This does not mean my prior work was wasted, because with v5 using forms in the line-table header, the FormParams had to be split out anyway.  But even with v5, if the header uses FORM_strx, or the line-number program wants to use the .debug_addr table, we still need the unit.  (And again, given how libDebugInfo works, even FORM_strp needs the DWARFUnit, even though it doesn't need anything from the actual compile unit.)

As I mentioned elsewhere, for my next trick I will conjure up a standalone v5 line table, and parse it without the assistance of any units.  But it will have to use all inline strings, until I can come back around to tracking the string sections independently of the DWARFUnit.


https://reviews.llvm.org/D39854





More information about the llvm-commits mailing list