diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2017-09-13 09:43:05 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2017-09-13 09:43:05 +0000 |
| commit | 27476ce24b988b463029ef63d30f5c081d38923e (patch) | |
| tree | d47fad0d3dc97db9cb184ec1d59ef1599f37e6d7 /llvm/lib | |
| parent | a753080d1e47ba0cf6e8cb4c62306dc0c6aa8e1c (diff) | |
| download | bcm5719-llvm-27476ce24b988b463029ef63d30f5c081d38923e.tar.gz bcm5719-llvm-27476ce24b988b463029ef63d30f5c081d38923e.zip | |
[dwarfdump] Rename Brief to Verbose in DIDumpOptions
This patches renames "brief" to "verbose" in de DIDumpOptions and
inverts the logic to match the new behavior where brief is the default.
Changing the default value uncovered some bugs related to the
DIDumpOptions not being propagated and have been fixed as well.
Differential revision: https://reviews.llvm.org/D37745
llvm-svn: 313139
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 22 |
5 files changed, 29 insertions, 28 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index b1d8f139544..e9b3c0c132e 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -202,7 +202,6 @@ static void dumpStringOffsetsSection(raw_ostream &OS, StringRef SectionName, void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { uint64_t DumpType = DumpOpts.DumpType; bool DumpEH = DumpOpts.DumpEH; - bool SummarizeTypes = DumpOpts.SummarizeTypes; if (DumpType & DIDT_DebugAbbrev) { OS << ".debug_abbrev contents:\n"; @@ -232,7 +231,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { OS << "\n.debug_types contents:\n"; for (const auto &TUS : type_unit_sections()) for (const auto &TU : TUS) - TU->dump(OS, SummarizeTypes); + TU->dump(OS, DumpOpts); } if ((DumpType & DIDT_DebugTypesDwo) && @@ -240,7 +239,7 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { OS << "\n.debug_types.dwo contents:\n"; for (const auto &DWOTUS : dwo_type_unit_sections()) for (const auto &DWOTU : DWOTUS) - DWOTU->dump(OS, SummarizeTypes); + DWOTU->dump(OS, DumpOpts); } if (DumpType & DIDT_DebugLoc) { @@ -434,9 +433,10 @@ DWARFDie DWARFContext::getDIEForOffset(uint32_t Offset) { return DWARFDie(); } -bool DWARFContext::verify(raw_ostream &OS, uint64_t DumpType) { +bool DWARFContext::verify(raw_ostream &OS, uint64_t DumpType, + DIDumpOptions DumpOpts) { bool Success = true; - DWARFVerifier verifier(OS, *this); + DWARFVerifier verifier(OS, *this, DumpOpts); Success &= verifier.handleDebugAbbrev(); if (DumpType & DIDT_DebugInfo) @@ -594,7 +594,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *U) { // Make sure the offset is good before we try to parse. if (stmtOffset >= U->getLineSection().Data.size()) - return nullptr; + return nullptr; // We have to parse it first. DWARFDataExtractor lineData(*DObj, U->getLineSection(), isLittleEndian(), diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 261a5cabffe..1af9c8001bb 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -59,7 +59,7 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, unsigned AddressSize, unsigned Indent, const DIDumpOptions &DumpOpts) { ArrayRef<SectionName> SectionNames; - if (!DumpOpts.Brief) + if (DumpOpts.Verbose) SectionNames = Obj.getSectionNames(); for (size_t I = 0; I < Ranges.size(); ++I) { @@ -83,7 +83,8 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS, } static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, - DWARFUnit *U, unsigned Indent) { + DWARFUnit *U, unsigned Indent, + DIDumpOptions DumpOpts) { DWARFContext &Ctx = U->getContext(); const DWARFObject &Obj = Ctx.getDWARFObj(); const MCRegisterInfo *MRI = Ctx.getRegisterInfo(); @@ -97,7 +98,7 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue, return; } - FormValue.dump(OS); + FormValue.dump(OS, DumpOpts); if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) { const DWARFSection &LocSection = Obj.getLocSection(); const DWARFSection &LocDWOSection = Obj.getLocDWOSection(); @@ -138,7 +139,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, else WithColor(OS, syntax::Attribute).get() << format("DW_AT_Unknown_%x", Attr); - if (!DumpOpts.Brief) { + if (DumpOpts.Verbose) { auto formString = FormEncodingString(Form); if (!formString.empty()) OS << " [" << formString << ']'; @@ -173,7 +174,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, OS << *formValue.getAsUnsignedConstant(); else if (Attr == DW_AT_location || Attr == DW_AT_frame_base || Attr == DW_AT_data_member_location) - dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4); + dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4, DumpOpts); else formValue.dump(OS, DumpOpts); @@ -388,7 +389,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth, unsigned Indent, WithColor(OS, syntax::Tag).get().indent(Indent) << format("DW_TAG_Unknown_%x", getTag()); - if (!DumpOpts.Brief) + if (DumpOpts.Verbose) OS << format(" [%u] %c", abbrCode, AbbrevDecl->hasChildren() ? '*' : ' '); OS << '\n'; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 8753746e1e8..d63e84ef4e7 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -481,7 +481,7 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { OS << Value.uval; break; case DW_FORM_strp: - if (!DumpOpts.Brief) + if (DumpOpts.Verbose) OS << format(" .debug_str[0x%8.8x] = ", (uint32_t)UValue); dumpString(OS); break; @@ -541,7 +541,7 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { break; } - if (CURelativeOffset && !DumpOpts.Brief) { + if (CURelativeOffset && DumpOpts.Verbose) { OS << " => {"; WithColor(OS, syntax::Address).get() << format("0x%8.8" PRIx64, UValue + (U ? U->getOffset() : 0)); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp index fd1684d33a1..67cc0505e18 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp @@ -31,11 +31,11 @@ bool DWARFTypeUnit::extractImpl(DataExtractor debug_info, return TypeOffset < getLength() + SizeOfLength; } -void DWARFTypeUnit::dump(raw_ostream &OS, bool SummarizeTypes) { +void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { DWARFDie TD = getDIEForOffset(TypeOffset + getOffset()); const char *Name = TD.getName(DINameKind::ShortName); - if (SummarizeTypes) { + if (DumpOpts.SummarizeTypes) { OS << "name = '" << Name << "'" << " type_signature = " << format("0x%016" PRIx64, TypeHash) << " length = " << format("0x%08x", getLength()) << '\n'; @@ -55,7 +55,7 @@ void DWARFTypeUnit::dump(raw_ostream &OS, bool SummarizeTypes) { << " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n"; if (DWARFDie TU = getUnitDIE(false)) - TU.dump(OS, -1U); + TU.dump(OS, -1U, 0, DumpOpts); else OS << "<type unit can't be parsed!>\n\n"; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 438764a8870..87b7be1eb84 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -236,13 +236,13 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, ++NumErrors; OS << "error: DW_AT_ranges offset is beyond .debug_ranges " "bounds:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } } else { ++NumErrors; OS << "error: DIE has invalid DW_AT_ranges encoding:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } break; @@ -254,13 +254,13 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die, OS << "error: DW_AT_stmt_list offset is beyond .debug_line " "bounds: " << format("0x%08" PRIx64, *SectionOffset) << "\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } } else { ++NumErrors; OS << "error: DIE has invalid DW_AT_stmt_list encoding:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } break; @@ -295,7 +295,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die, << format("0x%08" PRIx64, CUOffset) << " is invalid (must be less than CU size of " << format("0x%08" PRIx32, CUSize) << "):\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } else { // Valid reference, but we will verify it points to an actual @@ -315,7 +315,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die, ++NumErrors; OS << "error: DW_FORM_ref_addr offset beyond .debug_info " "bounds:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } else { // Valid reference, but we will verify it points to an actual @@ -331,7 +331,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die, if (SecOffset && *SecOffset >= DObj.getStringSection().size()) { ++NumErrors; OS << "error: DW_FORM_strp offset beyond .debug_str bounds:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << "\n"; } break; @@ -356,7 +356,7 @@ unsigned DWARFVerifier::verifyDebugInfoReferences() { << ". Offset is in between DIEs:\n"; for (auto Offset : Pair.second) { auto ReferencingDie = DCtx.getDIEForOffset(Offset); - ReferencingDie.dump(OS, 0); + ReferencingDie.dump(OS, 0, 0, DumpOpts); OS << "\n"; } OS << "\n"; @@ -381,7 +381,7 @@ void DWARFVerifier::verifyDebugLineStmtOffsets() { ++NumDebugLineErrors; OS << "error: .debug_line[" << format("0x%08" PRIx32, LineTableOffset) << "] was not able to be parsed for CU:\n"; - Die.dump(OS, 0); + Die.dump(OS, 0, 0, DumpOpts); OS << '\n'; continue; } @@ -399,8 +399,8 @@ void DWARFVerifier::verifyDebugLineStmtOffsets() { << format("0x%08" PRIx32, Iter->second.getOffset()) << " and " << format("0x%08" PRIx32, Die.getOffset()) << ", have the same DW_AT_stmt_list section offset:\n"; - Iter->second.dump(OS, 0); - Die.dump(OS, 0); + Iter->second.dump(OS, 0, 0, DumpOpts); + Die.dump(OS, 0, 0, DumpOpts); OS << '\n'; // Already verified this line table before, no need to do it again. continue; |

