From 1b2a65ca3a7fe00b503bf56ae613d084f45b12ab Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 14 Sep 2011 00:15:32 +0000 Subject: [PATCH] DebugInfo: Don't print DIEs multiple times. llvm-svn: 139671 --- llvm/lib/DebugInfo/DWARFCompileUnit.cpp | 3 +-- llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 4 +--- llvm/lib/DebugInfo/DWARFDebugInfoEntry.h | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/lib/DebugInfo/DWARFCompileUnit.cpp b/llvm/lib/DebugInfo/DWARFCompileUnit.cpp index 389de9d4e12d..224ae925c2ed 100644 --- a/llvm/lib/DebugInfo/DWARFCompileUnit.cpp +++ b/llvm/lib/DebugInfo/DWARFCompileUnit.cpp @@ -95,8 +95,7 @@ void DWARFCompileUnit::dump(raw_ostream &OS) { << ")\n"; extractDIEsIfNeeded(false); - for (unsigned i = 0, e = DieArray.size(); i != e; ++i) - DieArray[i].dump(OS, this, 10); + DieArray[0].dump(OS, this, -1U); } void DWARFCompileUnit::setDIERelations() { diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index bfe89dd32621..6923f6cce462 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -45,12 +45,10 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, const DWARFDebugInfoEntryMinimal *child = getFirstChild(); if (recurseDepth > 0 && child) { - indent += 2; while (child) { - child->dump(OS, cu, recurseDepth-1, indent); + child->dump(OS, cu, recurseDepth-1, indent+2); child = child->getSibling(); } - indent -= 2; } } else { OS << "Abbreviation code not found in 'debug_abbrev' class for code: " diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h index 0b0a00cf4f15..5e7b89b5a6e8 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h @@ -33,6 +33,9 @@ class DWARFDebugInfoEntryMinimal { const DWARFAbbreviationDeclaration *AbbrevDecl; public: + DWARFDebugInfoEntryMinimal() + : Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(0) {} + void dump(raw_ostream &OS, const DWARFCompileUnit *cu, unsigned recurseDepth, unsigned indent = 0) const; void dumpAttribute(raw_ostream &OS, const DWARFCompileUnit *cu,