| 2687 | |
| 2688 | |
| 2689 | void 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 | |
| 2729 | vector<ElfSymbolTableEntry> ElfView::ParseSymbolTable(BinaryReader& reader, const Elf64SectionHeader& symbolSection, |
nothing calls this directly
no test coverage detected