summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2024-06-11 14:55:11 -0400
committerAlexander Taylor <alex@vector35.com>2024-06-11 18:52:15 -0400
commit45fad4dda3783f119370a44c953e690948170c23 (patch)
treeac063d013d6ee4c99a3bc46b4be07ea6014a0d08 /rust/examples
parent617bb98e401110e3e1b81d87ab5db89a6e2c9e8b (diff)
Rebase DebugInfo function addresses.
Fixes #5231.
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
index c1690233..0d4fda98 100644
--- a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
+++ b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
@@ -404,7 +404,6 @@ impl DebugInfoBuilder {
}
pub(crate) fn post_process(&mut self, bv: &BinaryView, _debug_info: &mut DebugInfo) -> &Self {
- // TODO : We don't need post-processing if we process correctly the first time....
// When originally resolving names, we need to check:
// If there's already a name from binja that's "more correct" than what we found (has more namespaces)
// If there's no name for the DIE, but there's a linkage name that's resolved in binja to a usable name
@@ -436,8 +435,10 @@ impl DebugInfoBuilder {
}
}
- if let Some(address) = func.address {
- let existing_functions = bv.functions_at(address);
+ if let Some(address) = func.address.as_mut() {
+ let diff = bv.start() - bv.original_base();
+ *address += diff; // rebase the address
+ let existing_functions = bv.functions_at(*address);
match existing_functions.len().cmp(&1) {
Ordering::Greater => {
warn!("Multiple existing functions at address {address:08x}. One or more functions at this address may have the wrong platform information. Please report this binary.");