summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/DebugInfo/DIContext.h1
-rw-r--r--llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h3
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp10
-rw-r--r--llvm/test/DebugInfo/dwarfdump-dwp.test17
4 files changed, 26 insertions, 5 deletions
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h
index 87308470507..eff0e3e6786 100644
--- a/llvm/include/llvm/DebugInfo/DIContext.h
+++ b/llvm/include/llvm/DebugInfo/DIContext.h
@@ -125,6 +125,7 @@ enum DIDumpType {
DIDT_AppleNamespaces,
DIDT_AppleObjC,
DIDT_CUIndex,
+ DIDT_TUIndex,
};
class DIContext {
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
index 01d25f7aa8a..66204d7443e 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -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 DWARFContext {
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; }
};
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 9d5a78a0570..d6ed6f84207 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -165,6 +165,15 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
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::DWARFContextInMemory(const object::ObjectFile &Obj,
.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) {
diff --git a/llvm/test/DebugInfo/dwarfdump-dwp.test b/llvm/test/DebugInfo/dwarfdump-dwp.test
index 38630f6bb78..c3b8e1c4f9f 100644
--- a/llvm/test/DebugInfo/dwarfdump-dwp.test
+++ b/llvm/test/DebugInfo/dwarfdump-dwp.test
@@ -9,11 +9,18 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-dwp.x86_64.o | FileCheck %s
; 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
OpenPOWER on IntegriCloud