dwarfdump: DWP type unit index dumping skeleton

llvm-svn: 252786
This commit is contained in:
David Blaikie 2015-11-11 19:40:49 +00:00
parent 542f04cc4d
commit 51c402838c
4 changed files with 26 additions and 5 deletions

View File

@ -125,6 +125,7 @@ enum DIDumpType {
DIDT_AppleNamespaces,
DIDT_AppleObjC,
DIDT_CUIndex,
DIDT_TUIndex,
};
class DIContext {

View File

@ -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; }
};
}

View File

@ -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) {

View File

@ -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