Index: lib/DebugInfo/DWARF/DWARFDie.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFDie.cpp +++ lib/DebugInfo/DWARF/DWARFDie.cpp @@ -66,13 +66,16 @@ } static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, - uint32_t *OffsetPtr, dwarf::Attribute Attr, - dwarf::Form Form, unsigned Indent) { + uint32_t *OffsetPtr, + const DWARFAbbreviationDeclaration::AttributeSpec &AS, + unsigned Indent) { if (!Die.isValid()) return; const char BaseIndent[] = " "; OS << BaseIndent; OS.indent(Indent+2); + const auto Attr = AS.Attr; + const auto Form = AS.Form; auto attrString = AttributeString(Attr); if (!attrString.empty()) WithColor(OS, syntax::Attribute) << attrString; @@ -88,7 +91,9 @@ DWARFUnit *U = Die.getDwarfUnit(); DWARFFormValue formValue(Form); - if (!formValue.extractValue(U->getDebugInfoExtractor(), OffsetPtr, U)) + if (AS.isImplicitConst()) + formValue.setSValue(*AS.ByteSizeOrValue); + else if (!formValue.extractValue(U->getDebugInfoExtractor(), OffsetPtr, U)) return; OS << "\t("; @@ -334,16 +339,8 @@ AbbrevDecl->hasChildren() ? '*' : ' '); // Dump all data in the DIE for the attributes. - for (const auto &AttrSpec : AbbrevDecl->attributes()) { - if (AttrSpec.Form == DW_FORM_implicit_const) { - // We are dumping .debug_info section , - // implicit_const attribute values are not really stored here, - // but in .debug_abbrev section. So we just skip such attrs. - continue; - } - dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form, - Indent); - } + for (const auto &AttrSpec : AbbrevDecl->attributes()) + dumpAttribute(OS, *this, &offset, AttrSpec, Indent); DWARFDie child = getFirstChild(); if (RecurseDepth > 0 && child) { Index: lib/DebugInfo/DWARF/DWARFFormValue.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -503,6 +503,7 @@ } break; + case DW_FORM_implicit_const: case DW_FORM_sdata: OS << Value.sval; break; case DW_FORM_udata: OS << Value.uval; break; case DW_FORM_strp: Index: test/DebugInfo/dwarfdump-implicit-const.test =================================================================== --- test/DebugInfo/dwarfdump-implicit-const.test +++ test/DebugInfo/dwarfdump-implicit-const.test @@ -1,2 +1,6 @@ -RUN: llvm-dwarfdump -debug-dump=abbrev %p/Inputs/implicit-const-test.o | FileCheck %s -CHECK: DW_FORM_implicit_const -9223372036854775808 +RUN: llvm-dwarfdump -debug-dump=abbrev.dwo %p/Inputs/implicit-const-test.dwo | FileCheck --check-prefix=ABBREV-CHECK %s +RUN: llvm-dwarfdump -debug-dump=info.dwo %p/Inputs/implicit-const-test.dwo | FileCheck --check-prefix=INFO-CHECK %s +ABBREV-CHECK: DW_FORM_implicit_const +ABBREV-CHECK-SAME: -9223372036854775808 +INFO-CHECK: [DW_FORM_implicit_const] +INFO-CHECK-SAME: (-9223372036854775808)