From: David Blaikie Date: Wed, 11 Nov 2015 19:40:49 +0000 (+0000) Subject: dwarfdump: DWP type unit index dumping skeleton X-Git-Tag: android-x86-7.1-r4~41570 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8ad0ca8af4bd9c81333344a8510a60cabdf2406d;p=android-x86%2Fexternal-llvm.git dwarfdump: DWP type unit index dumping skeleton git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252786 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h index 87308470507..eff0e3e6786 100644 --- a/include/llvm/DebugInfo/DIContext.h +++ b/include/llvm/DebugInfo/DIContext.h @@ -125,6 +125,7 @@ enum DIDumpType { DIDT_AppleNamespaces, DIDT_AppleObjC, DIDT_CUIndex, + DIDT_TUIndex, }; class DIContext { diff --git a/include/llvm/DebugInfo/DWARF/DWARFContext.h b/include/llvm/DebugInfo/DWARF/DWARFContext.h index 01d25f7aa8a..66204d7443e 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/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, 4> UncompressedSections; @@ -296,6 +298,7 @@ public: return AddrSection; } StringRef getCUIndexSection() override { return CUIndexSection; } + StringRef getTUIndexSection() override { return TUIndexSection; } }; } diff --git a/lib/DebugInfo/DWARF/DWARFContext.cpp b/lib/DebugInfo/DWARF/DWARFContext.cpp index 9d5a78a0570..d6ed6f84207 100644 --- a/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/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/test/DebugInfo/dwarfdump-dwp.test b/test/DebugInfo/dwarfdump-dwp.test index 38630f6bb78..c3b8e1c4f9f 100644 --- a/test/DebugInfo/dwarfdump-dwp.test +++ b/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