summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-09-23 09:09:26 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-09-23 09:09:26 +0000
commita77bcf5e42e3a31508f8a261935d14dc35353ed8 (patch)
treeab5366ae87cab418480dc7939466194e277996fa /llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
parent355103f6c0f869028f3739cea663dddaaa08da48 (diff)
downloadbcm5719-llvm-a77bcf5e42e3a31508f8a261935d14dc35353ed8.tar.gz
bcm5719-llvm-a77bcf5e42e3a31508f8a261935d14dc35353ed8.zip
[llvm-dwarfdump] - Teach dwarfdump to dump gdb-index section.
gold linker's --gdb-index option currently is able to create the .gdb_index section that allows GDB to locate and read the .dwo files as it needs them, this helps reduce the total size of the object files processed by the linker. More info about that: https://gcc.gnu.org/wiki/DebugFission https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html Patch teaches dwarfdump tool to dump this section. Differential revision: https://reviews.llvm.org/D21503 llvm-svn: 282235
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index e8ea71b325a..1a0b7e568de 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -256,6 +256,12 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpType DumpType, bool DumpEH) {
}
}
+ if ((DumpType == DIDT_All || DumpType == DIDT_GdbIndex) &&
+ !getGdbIndexSection().empty()) {
+ OS << "\n.gnu_index contents:\n";
+ getGdbIndex().dump(OS);
+ }
+
if (DumpType == DIDT_All || DumpType == DIDT_AppleNames)
dumpAccelSection(OS, "apple_names", getAppleNamesSection(),
getStringSection(), isLittleEndian());
@@ -295,6 +301,16 @@ const DWARFUnitIndex &DWARFContext::getTUIndex() {
return *TUIndex;
}
+DWARFGdbIndex &DWARFContext::getGdbIndex() {
+ if (GdbIndex)
+ return *GdbIndex;
+
+ DataExtractor GdbIndexData(getGdbIndexSection(), true /*LE*/, 0);
+ GdbIndex = llvm::make_unique<DWARFGdbIndex>();
+ GdbIndex->parse(GdbIndexData);
+ return *GdbIndex;
+}
+
const DWARFDebugAbbrev *DWARFContext::getDebugAbbrev() {
if (Abbrev)
return Abbrev.get();
@@ -718,6 +734,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
.Case("apple_objc", &AppleObjCSection.Data)
.Case("debug_cu_index", &CUIndexSection)
.Case("debug_tu_index", &TUIndexSection)
+ .Case("gdb_index", &GdbIndexSection)
// Any more debug info sections go here.
.Default(nullptr);
if (SectionData) {
OpenPOWER on IntegriCloud