summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-11-11 19:28:21 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-11-11 19:28:21 +0000
commit65a8efe441f466dd044224247ec05b9fe5ea2f26 (patch)
treee07167534858a9e27b6b8a6909430aea761f1cf6 /llvm/lib/DebugInfo
parent316b5b250790d86dcd9206f06c792548a07105f4 (diff)
downloadbcm5719-llvm-65a8efe441f466dd044224247ec05b9fe5ea2f26.tar.gz
bcm5719-llvm-65a8efe441f466dd044224247ec05b9fe5ea2f26.zip
dwarfdump: First piece of support for DWP dumping
Just a tiny piece of index dumping - the header in this instance. llvm-svn: 252781
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/CMakeLists.txt1
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp10
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp41
3 files changed, 52 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/CMakeLists.txt b/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
index d5f8a6f24ee..b3df0422acf 100644
--- a/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
+++ b/llvm/lib/DebugInfo/DWARF/CMakeLists.txt
@@ -13,6 +13,7 @@ add_llvm_library(LLVMDebugInfoDWARF
DWARFDebugRangeList.cpp
DWARFFormValue.cpp
DWARFTypeUnit.cpp
+ DWARFUnitIndex.cpp
DWARFUnit.cpp
SyntaxHighlighting.cpp
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index aecd991ff0d..7ece6787d07 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -12,6 +12,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
+#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
@@ -155,6 +156,14 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType) {
}
}
+ if (DumpType == DIDT_All || DumpType == DIDT_CUIndex) {
+ OS << "\n.debug_cu_index contents:\n";
+ DataExtractor CUIndexData(getCUIndexSection(), isLittleEndian(), savedAddressByteSize);
+ DWARFUnitIndex CUIndex;
+ CUIndex.parse(CUIndexData);
+ CUIndex.dump(OS);
+ }
+
if (DumpType == DIDT_All || DumpType == DIDT_LineDwo) {
OS << "\n.debug_line.dwo contents:\n";
unsigned stmtOffset = 0;
@@ -608,6 +617,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
.Case("apple_namespaces", &AppleNamespacesSection.Data)
.Case("apple_namespac", &AppleNamespacesSection.Data)
.Case("apple_objc", &AppleObjCSection.Data)
+ .Case("debug_cu_index", &CUIndexSection)
// Any more debug info sections go here.
.Default(nullptr);
if (SectionData) {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
new file mode 100644
index 00000000000..5970fe03360
--- /dev/null
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -0,0 +1,41 @@
+//===-- DWARFUnitIndex.cpp ------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
+
+namespace llvm {
+
+bool DWARFUnitIndex::Header::parse(DataExtractor IndexData, uint32_t *OffsetPtr) {
+ Version = IndexData.getU32(OffsetPtr);
+ NumColumns = IndexData.getU32(OffsetPtr);
+ NumUnits = IndexData.getU32(OffsetPtr);
+ NumBuckets = IndexData.getU32(OffsetPtr);
+ return Version <= 2;
+}
+
+void DWARFUnitIndex::Header::dump(raw_ostream &OS) const {
+ OS << "Index header:\n" << format(" version: %u\n", Version)
+ << format(" columns: %u\n", NumColumns)
+ << format(" units: %u\n", NumUnits)
+ << format(" buckets: %u\n", NumBuckets);
+}
+
+bool DWARFUnitIndex::parse(DataExtractor IndexData) {
+ uint32_t Offset = 0;
+ if (!Header.parse(IndexData, &Offset))
+ return false;
+
+ return true;
+}
+
+void DWARFUnitIndex::dump(raw_ostream &OS) const {
+ Header.dump(OS);
+}
+
+}
OpenPOWER on IntegriCloud