diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2017-08-18 21:35:44 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2017-08-18 21:35:44 +0000 |
commit | a2faf7b60fc2022c86e97ebd846d1e7428a0375c (patch) | |
tree | b0632c5fa1e2211b3c579d9ffeabe2c071c91c45 /llvm/lib/DebugInfo/DWARF | |
parent | 69774d67c801d2ffc3c17bfc00b2aa4bd28324f5 (diff) | |
download | bcm5719-llvm-a2faf7b60fc2022c86e97ebd846d1e7428a0375c.tar.gz bcm5719-llvm-a2faf7b60fc2022c86e97ebd846d1e7428a0375c.zip |
[llvm-dwarfdump] Hide .debug_str and DIE reference offsets in brief mode
This patch hides the .debug_str offset and DIE reference offsets into
the CU when llvm-dwarfdump is invoked with -brief.
Differential Revision: https://reviews.llvm.org/D36835
llvm-svn: 311201
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 7 |
2 files changed, 13 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 42e014f87ff..9ad4b5212ee 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -106,12 +106,12 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, DWARFUnit *U = Die.getDwarfUnit(); DWARFFormValue formValue(Form); - + if (!formValue.extractValue(U->getDebugInfoExtractor(), OffsetPtr, U)) return; - + OS << "\t("; - + StringRef Name; std::string File; auto Color = syntax::Enumerator; @@ -124,14 +124,14 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, } } else if (Optional<uint64_t> Val = formValue.getAsUnsignedConstant()) Name = AttributeValueString(Attr, *Val); - + if (!Name.empty()) WithColor(OS, Color) << Name; else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) OS << *formValue.getAsUnsignedConstant(); else - formValue.dump(OS); - + formValue.dump(OS, DumpOpts); + // We have dumped the attribute raw value. For some attributes // having both the raw value and the pretty-printed value is // interesting. These attributes are handled below. @@ -328,11 +328,11 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth, unsigned Indent, DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor(); const uint32_t Offset = getOffset(); uint32_t offset = Offset; - + if (debug_info_data.isValidOffset(offset)) { uint32_t abbrCode = debug_info_data.getULEB128(&offset); WithColor(OS, syntax::Address).get() << format("\n0x%8.8x: ", Offset); - + if (abbrCode) { auto AbbrevDecl = getAbbreviationDeclarationPtr(); if (AbbrevDecl) { @@ -359,7 +359,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth, unsigned Indent, dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form, Indent, DumpOpts); } - + DWARFDie child = getFirstChild(); if (RecurseDepth > 0 && child) { while (child) { diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 83a7792e124..8753746e1e8 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -396,7 +396,7 @@ bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data, return true; } -void DWARFFormValue::dump(raw_ostream &OS) const { +void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { uint64_t UValue = Value.uval; bool CURelativeOffset = false; @@ -481,7 +481,8 @@ void DWARFFormValue::dump(raw_ostream &OS) const { OS << Value.uval; break; case DW_FORM_strp: - OS << format(" .debug_str[0x%8.8x] = ", (uint32_t)UValue); + if (!DumpOpts.Brief) + OS << format(" .debug_str[0x%8.8x] = ", (uint32_t)UValue); dumpString(OS); break; case DW_FORM_strx: @@ -540,7 +541,7 @@ void DWARFFormValue::dump(raw_ostream &OS) const { break; } - if (CURelativeOffset) { + if (CURelativeOffset && !DumpOpts.Brief) { OS << " => {"; WithColor(OS, syntax::Address).get() << format("0x%8.8" PRIx64, UValue + (U ? U->getOffset() : 0)); |