Skip to content

Commit 8127c87

Browse files
committed
Fix loading .gnu_debugdata when loading an ELF with non-zero base
1 parent 3d73ec6 commit 8127c87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

view/elf/elfview.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,9 @@ void ElfView::ParseMiniDebugInfo()
27002700
return;
27012701
}
27022702

2703-
Ref<BinaryView> debugBv = Load(debugElf, false);
2703+
// Load debug bv at same address as this bv
2704+
string debugBvOptions = fmt::format("{{\"loader.imageBase\": {}}}", GetStart());
2705+
Ref<BinaryView> debugBv = Load(debugElf, false, debugBvOptions);
27042706
if (!debugBv)
27052707
{
27062708
m_logger->LogError("Invalid .gnu_debugdata contents: Failed to create BinaryView");
@@ -2712,7 +2714,7 @@ void ElfView::ParseMiniDebugInfo()
27122714
DefineElfSymbol(
27132715
symbol->GetType(),
27142716
symbol->GetRawName(),
2715-
GetStart() + symbol->GetAddress(),
2717+
symbol->GetAddress(),
27162718
false,
27172719
symbol->GetBinding()
27182720
);

0 commit comments

Comments
 (0)