dwarfdump/symbolizer: Avoid loading unneeded CUs from a DWP

When symbolizing large binaries, parsing every CU in a DWP file is a
significant performance penalty. Instead, use the index to only load the
CUs that are needed.

llvm-svn: 313659
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 90df9f4..0e28954 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -464,12 +464,11 @@
 }
 
 DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
-  parseDWOCompileUnits();
+  DWOCUs.parseDWO(*this, DObj->getInfoDWOSection(), true);
 
   if (const auto &CUI = getCUIndex()) {
     if (const auto *R = CUI.getFromHash(Hash))
-      if (auto CUOff = R->getOffset(DW_SECT_INFO))
-        return DWOCUs.getUnitForOffset(CUOff->Offset);
+      return DWOCUs.getUnitForIndexEntry(*R);
     return nullptr;
   }