diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-10-05 20:55:20 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-10-05 20:55:20 +0000 |
commit | fdada09fa4351b270df0cbfe5ef72aa2853b9f26 (patch) | |
tree | 2b215514d9a9e7a423b4457b238e4bd386d73e8c /llvm/lib/DebugInfo | |
parent | 5931b4e5b5de31bd366cbeb773f53357a0985e68 (diff) | |
download | bcm5719-llvm-fdada09fa4351b270df0cbfe5ef72aa2853b9f26.tar.gz bcm5719-llvm-fdada09fa4351b270df0cbfe5ef72aa2853b9f26.zip |
dwarfdump: Avoid parsing units unnecessarily
NFC-ish (the parsing of the units is not a functional change - no
errors/warnings are emitted during the shallow parsing - though without
parsing them here, the "max version" would be wrong (still zero) later
on, so in those cases the units do need to be parsed)
llvm-svn: 343884
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 5d9f5a328ae..118a2ebf127 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -328,21 +328,20 @@ void DWARFContext::dump( DObj->getAbbrevDWOSection())) getDebugAbbrevDWO()->dump(OS); - auto dumpDebugInfo = [&](bool IsExplicit, const char *Name, - DWARFSection Section, unit_iterator_range Units) { - if (shouldDump(IsExplicit, Name, DIDT_ID_DebugInfo, Section.Data)) { - if (DumpOffset) - getDIEForOffset(DumpOffset.getValue()) - .dump(OS, 0, DumpOpts.noImplicitRecursion()); - else - for (const auto &U : Units) - U->dump(OS, DumpOpts); - } + auto dumpDebugInfo = [&](unit_iterator_range Units) { + if (DumpOffset) + getDIEForOffset(DumpOffset.getValue()) + .dump(OS, 0, DumpOpts.noImplicitRecursion()); + else + for (const auto &U : Units) + U->dump(OS, DumpOpts); }; - dumpDebugInfo(Explicit, ".debug_info", DObj->getInfoSection(), - info_section_units()); - dumpDebugInfo(ExplicitDWO, ".debug_info.dwo", DObj->getInfoDWOSection(), - dwo_info_section_units()); + if (shouldDump(Explicit, ".debug_info", DIDT_ID_DebugInfo, + DObj->getInfoSection().Data)) + dumpDebugInfo(info_section_units()); + if (shouldDump(ExplicitDWO, ".debug_info.dwo", DIDT_ID_DebugInfo, + DObj->getInfoDWOSection().Data)) + dumpDebugInfo(dwo_info_section_units()); auto dumpDebugType = [&](const char *Name, unit_iterator_range Units) { OS << '\n' << Name << " contents:\n"; @@ -543,7 +542,7 @@ void DWARFContext::dump( dumpStringOffsetsSection(OS, "debug_str_offsets.dwo", *DObj, DObj->getStringOffsetDWOSection(), DObj->getStringDWOSection(), dwo_units(), - isLittleEndian(), getMaxVersion()); + isLittleEndian(), getMaxDWOVersion()); if (shouldDump(Explicit, ".gnu_index", DIDT_ID_GdbIndex, DObj->getGdbIndexSection())) { |