summaryrefslogtreecommitdiff
path: root/view/elf/elfview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'view/elf/elfview.cpp')
-rw-r--r--view/elf/elfview.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index 677f0b67..b90b18a7 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -1325,6 +1325,8 @@ bool ElfView::Init()
}
}
+ ParseMiniDebugInfo();
+
// Process the queued symbols
m_symbolQueue->Process();
delete m_symbolQueue;
@@ -2608,6 +2610,44 @@ bool ElfView::DerefPpc64Descriptor(BinaryReader& reader, uint64_t addr, uint64_t
}
+void ElfView::ParseMiniDebugInfo()
+{
+ Ref<Section> gnuDebugdata = GetParentView()->GetSectionByName(".gnu_debugdata");
+ if (!gnuDebugdata)
+ return;
+
+ BinaryReader debugdataReader(GetParentView());
+ debugdataReader.Seek(gnuDebugdata->GetStart());
+
+ DataBuffer compressedDebug = debugdataReader.Read(gnuDebugdata->GetLength());
+
+ DataBuffer debugElf;
+ if (!compressedDebug.XzDecompress(debugElf))
+ {
+ m_logger->LogError("Invalid .gnu_debugdata contents: Failed to decompress");
+ return;
+ }
+
+ Ref<BinaryView> debugBv = Load(debugElf, false);
+ if (!debugBv)
+ {
+ m_logger->LogError("Invalid .gnu_debugdata contents: Failed to create BinaryView");
+ return;
+ }
+
+ for (const auto& symbol : debugBv->GetSymbols())
+ {
+ DefineElfSymbol(
+ symbol->GetType(),
+ symbol->GetRawName(),
+ GetStart() + symbol->GetAddress(),
+ false,
+ symbol->GetBinding()
+ );
+ }
+}
+
+
vector<ElfSymbolTableEntry> ElfView::ParseSymbolTable(BinaryReader& reader, const Elf64SectionHeader& symbolSection,
const Elf64SectionHeader& stringSection, bool dynamic, size_t startEntry)
{