MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ParseMiniDebugInfo

Method ParseMiniDebugInfo

view/elf/elfview.cpp:2689–2726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2687
2688
2689void ElfView::ParseMiniDebugInfo()
2690{
2691 Ref<Section> gnuDebugdata = GetParentView()->GetSectionByName(".gnu_debugdata");
2692 if (!gnuDebugdata)
2693 return;
2694
2695 BinaryReader debugdataReader(GetParentView());
2696 debugdataReader.Seek(gnuDebugdata->GetStart());
2697
2698 DataBuffer compressedDebug = debugdataReader.Read(gnuDebugdata->GetLength());
2699
2700 DataBuffer debugElf;
2701 if (!compressedDebug.XzDecompress(debugElf))
2702 {
2703 m_logger->LogError("Invalid .gnu_debugdata contents: Failed to decompress");
2704 return;
2705 }
2706
2707 // Load debug bv at same address as this bv
2708 string debugBvOptions = fmt::format("{{\"loader.imageBase\": {}}}", GetStart());
2709 Ref<BinaryView> debugBv = Load(debugElf, false, debugBvOptions);
2710 if (!debugBv)
2711 {
2712 m_logger->LogError("Invalid .gnu_debugdata contents: Failed to create BinaryView");
2713 return;
2714 }
2715
2716 for (const auto& symbol : debugBv->GetSymbols())
2717 {
2718 DefineElfSymbol(
2719 symbol->GetType(),
2720 symbol->GetRawName(),
2721 symbol->GetAddress(),
2722 false,
2723 symbol->GetBinding()
2724 );
2725 }
2726}
2727
2728
2729vector<ElfSymbolTableEntry> ElfView::ParseSymbolTable(BinaryReader& reader, const Elf64SectionHeader& symbolSection,

Callers

nothing calls this directly

Calls 13

GetSectionByNameMethod · 0.80
XzDecompressMethod · 0.80
LogErrorMethod · 0.80
GetRawNameMethod · 0.80
GetBindingMethod · 0.80
LoadFunction · 0.50
SeekMethod · 0.45
GetStartMethod · 0.45
ReadMethod · 0.45
GetLengthMethod · 0.45
GetSymbolsMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected