DebugInfo: Don't print DIEs multiple times.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 14 Sep 2011 00:15:32 +0000 (00:15 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 14 Sep 2011 00:15:32 +0000 (00:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139671 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/DWARFCompileUnit.cpp
lib/DebugInfo/DWARFDebugInfoEntry.cpp
lib/DebugInfo/DWARFDebugInfoEntry.h

index 389de9d4e12df4da62bbf749ef9578b553924795..224ae925c2ed30f254db7166db94d304e39f934e 100644 (file)
@@ -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() {
index bfe89dd326219f2ffece6d8d572368a6b0952d73..6923f6cce46217a78dfb56df14c9e959ee616993 100644 (file)
@@ -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: "
index 0b0a00cf4f1502d177fcdf5bb8af28a92eb52b1c..5e7b89b5a6e848f15a1b5cc60555f285102b0eb7 100644 (file)
@@ -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,