summaryrefslogtreecommitdiff
path: root/view/elf
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-03-18 12:30:59 -0400
committerJosh Ferrell <josh@vector35.com>2025-03-18 12:30:59 -0400
commit8127c87b2e5ddf6987dbd4104b37f4cbc4624356 (patch)
treef834a9f5024806f93ec613e701996683c71d5fc9 /view/elf
parent3d73ec6994319e90ac08d2d5757ae6598c09373a (diff)
Fix loading .gnu_debugdata when loading an ELF with non-zero base
Diffstat (limited to 'view/elf')
-rw-r--r--view/elf/elfview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index d6e9006e..c87c9e05 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -2700,7 +2700,9 @@ void ElfView::ParseMiniDebugInfo()
return;
}
- Ref<BinaryView> debugBv = Load(debugElf, false);
+ // Load debug bv at same address as this bv
+ string debugBvOptions = fmt::format("{{\"loader.imageBase\": {}}}", GetStart());
+ Ref<BinaryView> debugBv = Load(debugElf, false, debugBvOptions);
if (!debugBv)
{
m_logger->LogError("Invalid .gnu_debugdata contents: Failed to create BinaryView");
@@ -2712,7 +2714,7 @@ void ElfView::ParseMiniDebugInfo()
DefineElfSymbol(
symbol->GetType(),
symbol->GetRawName(),
- GetStart() + symbol->GetAddress(),
+ symbol->GetAddress(),
false,
symbol->GetBinding()
);