From 0ea26e7c9b6379c18fd0aa685b92e520db7e72dc Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Wed, 23 Oct 2024 16:04:04 -0700 Subject: [PATCH 1/2] Update dependencies --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a41678e..3f75b11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,9 @@ edition="2021" [dependencies] libc = "0.2" log = "0.4" -proc-maps = "0.3.2" +proc-maps = "0.4" read-process-memory = "0.1.6" -goblin = "0.7.1" +goblin = "0.9" memmap = "0.7.0" regex = ">=1.8.3" @@ -26,9 +26,9 @@ libproc = "0.14" [target.'cfg(target_os="linux")'.dependencies] nix = {version = "0.26", default-features = false, features = ["ptrace", "sched", "signal"]} -object = "0.32" -addr2line = "0.21" -lazy_static = "1.4.0" +object = "0.36" +addr2line = "0.24" +lazy_static = "1.5.0" [target.'cfg(windows)'.dependencies] winapi = {version = "0.3", features = ["winbase", "consoleapi", "wincon", "handleapi", "timeapi", "processenv" ]} From 2a69fd4a686f027cf3858049472d11f7c843c7f5 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Mon, 28 Oct 2024 11:53:09 -0700 Subject: [PATCH 2/2] update to latest addr2line --- src/linux/symbolication.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/linux/symbolication.rs b/src/linux/symbolication.rs index 10296a6..4a57373 100644 --- a/src/linux/symbolication.rs +++ b/src/linux/symbolication.rs @@ -7,7 +7,7 @@ use log::{debug, error, info, trace, warn}; use memmap2::Mmap; use crate::{Error, Pid, Process, StackFrame}; -use addr2line::ObjectContext; +use addr2line::Loader; use goblin; use goblin::elf::program_header::*; use object::{self, Object, ObjectSymbol}; @@ -211,7 +211,7 @@ impl Symbolicator { pub struct SymbolData { // Contains symbol info for a single binary - ctx: ObjectContext, + address_loader: Loader, offset: u64, symbols: Vec<(u64, u64, String)>, dynamic_symbols: Vec<(u64, u64, String)>, @@ -238,7 +238,7 @@ impl SymbolData { } }; - let ctx = ObjectContext::new(&file).map_err(|e| { + let address_loader = Loader::new(filename).map_err(|e| { Error::Other(format!( "Failed to get symbol context for {}: {:?}", filename, e @@ -261,7 +261,7 @@ impl SymbolData { } dynamic_symbols.sort_unstable_by(|a, b| a.cmp(&b)); Ok(SymbolData { - ctx, + address_loader, offset, dynamic_symbols, symbols, @@ -291,17 +291,13 @@ impl SymbolData { if line_info { let mut has_debug_info = false; - // addr2line0.8 uses an older version of gimli (0.0.19) than we are using here (0.0.21), - // this means we can't use the type of the error returned ourselves here since the - // type alias is private. hack by re-mapping the error - let error_handler = |e| Error::Other(format!("addr2line error: {:?}", e)); - // if we have debugging info, get the appropriate stack frames for the address let mut frames = self - .ctx + .address_loader .find_frames(offset) - .skip_all_loads() - .map_err(error_handler)?; + .map_err(|e| Error::Other(format!("addr2line error: {:?}", e)))?; + + let error_handler = |e| Error::Other(format!("addr2line error: {:?}", e)); while let Some(frame) = frames.next().map_err(error_handler)? { has_debug_info = true; if let Some(func) = frame.function {