<div dir="ltr">A few general design discussions that cross multiple patches, so figure it's worth discussing here:<br><br>The DWARFUnitSection is currently (before your changes) representing the contents from a single section - and most/all of the classes in libDebugInfoDWARF use "parse" to initialize their complete state. So it's a bit novel/new/different/worth considering (maybe renaming the function or the like) what it means to make this class now represent data from multiple sections and to be documentend/intended to be used to aggregate the parsing result from multiple sections (both multiple sections with the same name (debug_types currently, or in v5 debug_info comdat sections for type units)). One observable part of the matter of which sections come from is the section relative offsets (you'll see the difference in dumping a file with at least 2 types with type units enabled, with and without split DWARF - without split DWARF comdat sections are used, so each types section offsets are zerod at the start of each type unit because it's a separate section (even though it has the same section name) - whereas in split DWARF, in the .dwo file the offsets are across the whole, singular, debug_types.dwo section)<br><br>As for virtuality in the unit hierarchy - reckon it's worth it, or maybe just use a union/conditional for the dumping differences (& collapse/remove the type distinction between type units and compile units - just have DWARFUnit as the only unit class)? (since it's just the type_signature V DWO_id (maybe we could generalize that to "id") and type_offset that's different between them).</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 24, 2018 at 10:40 AM via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello DWARF fans,<br>
<br>
I've just posted a set of four refactoring patches for DebugInfo/DWARF,<br>
which move in the direction of handling DWARF v4 or v5 type units and<br>
compile units more coherently.<br>
<br>
In DWARF v4, type units and compile units are strictly segregated into<br>
the .debug_types and .debug_info sections, respectively.  This division<br>
was pretty ingrained into how DebugInfo/DWARF handled the units.<br>
<br>
In DWARF v5, type units and compile units are all in the .debug_info<br>
section, and the .debug_types section is obsolete.  So, we need to have<br>
a container than can handle both kinds of units in a straightforward way.<br>
<br>
The refactoring replaces a pair of collections templated on the unit type<br>
with a single collection whose elements are base-class pointers; thus it<br>
can contain elements that are a mix of unit kinds.  Everything that really<br>
mattered was either already virtual or was straightforward to convert to<br>
generic handling.  I think I needed only one type-based conditional, on<br>
top of what already existed.  The code doesn't *quite* support DWARF v5<br>
type units in the .debug_info section, but the new starting point should<br>
make that straightforward.<br>
<br>
In a mixed v4/v5 executable, we can pretend the .debug_types sections<br>
are all really .debug_info sections, and tack them onto the end of the<br>
vector of units that already handles a mix of compile and type units.<br>
This is also how the LLDB DWARF parser handles this case, so it's at<br>
least consistent in principle (even if the actual code differs).<br>
<br>
The existing distinction between "normal" and split (DWO) units remains;<br>
that has to do with what information exists in which object files, and<br>
is not fundamentally changing in DWARF v5.<br>
<br>
Patch 1: De-templatize DWARFUnitSection<br>
         <a href="https://reviews.llvm.org/D49741" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49741</a><br>
Patch 2: The TU collection doesn't need to be a deque<br>
         <a href="https://reviews.llvm.org/D49742" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49742</a><br>
Patch 3: Rename DWARFUnitSection to DWARFUnitVector<br>
         <a href="https://reviews.llvm.org/D49743" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49743</a><br>
Patch 4: Unify handling of type and compile units<br>
         <a href="https://reviews.llvm.org/D49744" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49744</a><br>
<br>
Thanks,<br>
--paulr<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>