Skip to content

Commit 1e99e66

Browse files
committed
Fix relative/absolute mess.
1 parent 1660946 commit 1e99e66

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/symbolizer.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ impl Symbolizer {
276276
line_number: None,
277277
};
278278

279-
// For return addresses in stack traces, we usually want to subtract 1
280-
// to get the actual call site rather than the return address
281-
// let lookup_address = if address > 0 { address - 1 } else { address };
282279
let lookup_address = address;
283280

284281
// Try to find which library this address belongs to
@@ -295,7 +292,7 @@ impl Symbolizer {
295292
if let Some(lib_info) = self.libraries.get(&pathname) {
296293
// Adjust address relative to library base (file start, not executable segment)
297294
if let Some(adr) = self.file_base_addresses.get(&pathname) {
298-
let relative_address = lookup_address - adr;
295+
let relative_address = address - adr;
299296

300297
// Try with loader first if available
301298
if let Some(ref loader) = lib_info.loader {
@@ -312,7 +309,7 @@ impl Symbolizer {
312309
}
313310

314311
// Fall back to symbol table lookup
315-
if let Some(symbol) = find_symbol_for_address(&lib_info.symbols, relative_address) {
312+
if let Some(symbol) = find_symbol_for_address(&lib_info.symbols, address) {
316313
result.function_name = Some(symbol.name.clone());
317314
return result;
318315
}
@@ -329,20 +326,19 @@ impl Symbolizer {
329326
// Look for a mapping that contains this address but isn't a library
330327
let main_relative_address = if let Some(main_mapping) = self.find_library_for_address(address) {
331328
if let Some(&main_exe_base) = self.file_base_addresses.get(&main_mapping.pathname) {
332-
lookup_address - main_exe_base
329+
address - main_exe_base
333330
} else {
334-
lookup_address
331+
address
335332
}
336333
} else {
337-
lookup_address
334+
address
338335
};
339336

340337
if let Some(symbolized) = self.try_symbolize_with_context(&self.main_context, main_relative_address, address) {
341338
return symbolized;
342339
}
343340

344341
// Fall back to symbol table lookup for main executable
345-
//if let Some(symbol) = find_symbol_for_address(&self.symbols, main_relative_address) {
346342
if let Some(symbol) = find_symbol_for_address(&self.symbols, address) {
347343
result.function_name = Some(symbol.name.clone());
348344
return result;

0 commit comments

Comments
 (0)