[PATCH] Factor the Unit section parsing into the DWARFUnitSection class.

Alexey Samsonov vonosmas at gmail.com
Mon Sep 29 15:15:29 PDT 2014


================
Comment at: lib/DebugInfo/DWARFUnit.h:65
@@ -63,1 +64,3 @@
 
+  void parse(DWARFContext &Context, const DWARFDebugAbbrev *DA,
+             StringRef Section, StringRef RS, StringRef SS, StringRef SOS,
----------------
friss wrote:
> samsonov wrote:
> > Can't you fetch all the sections' contents (debug_abbrev, debug_ranges, debug_addr etc.) by using a "Context" argument?
> Not trivially, because the sections are different between dwo and normal sections. Would you prefer that the patch implements parse() and parseDWO() that fetch the sections themselves (and have the current parse() become a private parseImpl() method)?
Yes, I'd prefer that. This would make the caller's code simpler. After that (in the follow-up changes), we can probably go on and sink getDebugAbbrev() / getRangeSection() / isLittleEndian() and calls like that further down to DWARFUnit (not DWARFUnitSection) constructor: after your recent changes DWARFUnit ctor now takes a reference to full DWARFContext.

We might even discriminate between regular and .dwo units by making them different classes, inherited from DWARFUnit. For instance, both regular and dwo units now have a reference to corresponding .dwo unit (DWOHolder stuff), which makes no sense.

http://reviews.llvm.org/D5522






More information about the llvm-commits mailing list