diff options
| author | Alexander Taylor <alex@vector35.com> | 2024-08-29 17:54:16 -0400 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2024-08-30 14:46:20 -0400 |
| commit | 554709fc9c13d38195de9809dccff7af3ac2944b (patch) | |
| tree | 9d35def47f75892da81931923f63a0aed822a58a /rust/examples | |
| parent | 29a13aaef41bcede53ed58ba0dd9a487ed7ea534 (diff) | |
Don't rebase DWARF info in overflowing situations.
This appears to fix a bug in a TriCore unit test for reasons I don't
fully understand.
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs index d7ffb8c1..140e3af5 100644 --- a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs +++ b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs @@ -533,15 +533,17 @@ impl DebugInfoBuilder { } if let Some(address) = func.address.as_mut() { - let diff = bv.start().overflowing_sub(bv.original_image_base()).0; - *address = (*address).overflowing_add(diff).0; // 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."); + let (diff, overflowed) = bv.start().overflowing_sub(bv.original_image_base()); + if !overflowed { + *address = (*address).overflowing_add(diff).0; // 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."); + } + Ordering::Equal => func.platform = Some(existing_functions.get(0).platform()), + Ordering::Less => {} } - Ordering::Equal => func.platform = Some(existing_functions.get(0).platform()), - Ordering::Less => {} } } } |
