[PATCH] D36313: [llvm-dwarfdump] - Print section name and index when dumping .debug_info ranges

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 16:58:06 PDT 2017


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks OK to me - though please refactor the section name/uniqueness gathering so it's done once (probably lazily) rather than every time a range is dumped.



================
Comment at: lib/DebugInfo/DWARF/DWARFDie.cpp:60-71
+  StringMap<unsigned> SectionAmountMap;
+  std::vector<StringRef> SectionNames;
+  if (Obj.getFile() && !DumpOpts.Brief) {
+    for (const SectionRef &Section : Obj.getFile()->sections()) {
+      StringRef Name;
+      if (Section.getName(Name))
+        Name = "<error>";
----------------
Presumably this shouldn't be computed for each range that's dumped?

Maybe a lazy accessor on DWARFContext that populates the list the first time it's called?


https://reviews.llvm.org/D36313





More information about the llvm-commits mailing list