[llvm] r252786 - dwarfdump: DWP type unit index dumping skeleton

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 11:40:50 PST 2015


Author: dblaikie
Date: Wed Nov 11 13:40:49 2015
New Revision: 252786

URL: http://llvm.org/viewvc/llvm-project?rev=252786&view=rev
Log:
dwarfdump: DWP type unit index dumping skeleton

Modified:
    llvm/trunk/include/llvm/DebugInfo/DIContext.h
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
    llvm/trunk/test/DebugInfo/dwarfdump-dwp.test

Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=252786&r1=252785&r2=252786&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Wed Nov 11 13:40:49 2015
@@ -125,6 +125,7 @@ enum DIDumpType {
   DIDT_AppleNamespaces,
   DIDT_AppleObjC,
   DIDT_CUIndex,
+  DIDT_TUIndex,
 };
 
 class DIContext {

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=252786&r1=252785&r2=252786&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Wed Nov 11 13:40:49 2015
@@ -204,6 +204,7 @@ public:
   virtual const DWARFSection& getAppleNamespacesSection() = 0;
   virtual const DWARFSection& getAppleObjCSection() = 0;
   virtual StringRef getCUIndexSection() = 0;
+  virtual StringRef getTUIndexSection() = 0;
 
   static bool isSupportedVersion(unsigned version) {
     return version == 2 || version == 3 || version == 4;
@@ -253,6 +254,7 @@ class DWARFContextInMemory : public DWAR
   DWARFSection AppleNamespacesSection;
   DWARFSection AppleObjCSection;
   StringRef CUIndexSection;
+  StringRef TUIndexSection;
 
   SmallVector<SmallString<32>, 4> UncompressedSections;
 
@@ -296,6 +298,7 @@ public:
     return AddrSection;
   }
   StringRef getCUIndexSection() override { return CUIndexSection; }
+  StringRef getTUIndexSection() override { return TUIndexSection; }
 };
 
 }

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=252786&r1=252785&r2=252786&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Wed Nov 11 13:40:49 2015
@@ -165,6 +165,15 @@ void DWARFContext::dump(raw_ostream &OS,
     CUIndex.dump(OS);
   }
 
+  if (DumpType == DIDT_All || DumpType == DIDT_TUIndex) {
+    OS << "\n.debug_tu_index contents:\n";
+    DataExtractor TUIndexData(getTUIndexSection(), isLittleEndian(),
+                              savedAddressByteSize);
+    DWARFUnitIndex TUIndex;
+    TUIndex.parse(TUIndexData);
+    TUIndex.dump(OS);
+  }
+
   if (DumpType == DIDT_All || DumpType == DIDT_LineDwo) {
     OS << "\n.debug_line.dwo contents:\n";
     unsigned stmtOffset = 0;
@@ -619,6 +628,7 @@ DWARFContextInMemory::DWARFContextInMemo
             .Case("apple_namespac", &AppleNamespacesSection.Data)
             .Case("apple_objc", &AppleObjCSection.Data)
             .Case("debug_cu_index", &CUIndexSection)
+            .Case("debug_tu_index", &TUIndexSection)
             // Any more debug info sections go here.
             .Default(nullptr);
     if (SectionData) {

Modified: llvm/trunk/test/DebugInfo/dwarfdump-dwp.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-dwp.test?rev=252786&r1=252785&r2=252786&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-dwp.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-dwp.test Wed Nov 11 13:40:49 2015
@@ -9,11 +9,18 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-
 ;   foo b;
 
 ; CHECK: .debug_cu_index contents:
-; CHECK: version: 2
-; CHECK: columns: 4
-; CHECK:   units: 2
-; CHECK: buckets: 16
+; CHECK-NEXT: Index header:
+; CHECK-NEXT: version: 2
+; CHECK-NEXT: columns: 4
+; CHECK-NEXT:   units: 2
+; CHECK-NEXT: buckets: 16
+
+; CHECK: .debug_tu_index contents:
+; CHECK-NEXT: Index header:
+; CHECK-NEXT: version: 2
+; CHECK-NEXT: columns: 4
+; CHECK-NEXT:   units: 1
+; CHECK-NEXT: buckets: 16
 
-; TODO: debug_tu_index
 ; TODO: dump the index contents
 ; TODO: use the index section offset info to correctly dump debug_info




More information about the llvm-commits mailing list