diff --git a/reverie/Cargo.toml b/reverie/Cargo.toml index 4ec4347..57b2619 100644 --- a/reverie/Cargo.toml +++ b/reverie/Cargo.toml @@ -8,12 +8,11 @@ edition = "2021" license = "BSD-2-Clause" [dependencies] -addr2line = "0.18" +addr2line = "0.21" anyhow = "1.0.75" async-trait = "0.1.71" bitflags = "1.3" byteorder = "1.3" -gimli = "0.26" lazy_static = "1.4" libc = "0.2.139" linked-hash-map = { version = "0.5", features = ["serde_impl"] } diff --git a/reverie/src/backtrace/mod.rs b/reverie/src/backtrace/mod.rs index 1b50d7a..6cc4d3d 100644 --- a/reverie/src/backtrace/mod.rs +++ b/reverie/src/backtrace/mod.rs @@ -16,6 +16,8 @@ use std::io; use std::io::Read; use std::path::PathBuf; +use addr2line::LookupContinuation; +use addr2line::LookupResult; use serde::Deserialize; use serde::Serialize; @@ -155,7 +157,20 @@ impl Backtrace { let symbols = cache.load(library)?; // Find the file + line number of the instruction pointer. - if let Ok(mut source_frames) = symbols.find_frames(addr) { + let mut lookup_result = symbols.find_frames(addr); + if let Ok(mut source_frames) = loop { + match lookup_result { + LookupResult::Output(result) => break result, + LookupResult::Load { + load: _, + continuation, + } => { + // FIXME support Split DWARF + // let dwo = do_split_dwarf_load(load); + lookup_result = continuation.resume(None); + } + } + } { while let Ok(Some(f)) = source_frames.next() { if let Some(loc) = f.location { locations.push(Location { diff --git a/reverie/src/backtrace/symbols.rs b/reverie/src/backtrace/symbols.rs index 41b8714..4445f8d 100644 --- a/reverie/src/backtrace/symbols.rs +++ b/reverie/src/backtrace/symbols.rs @@ -14,8 +14,9 @@ use std::os::unix::ffi::OsStrExt; use std::path::Path; use std::path::PathBuf; -use gimli::EndianSlice; -use gimli::RunTimeEndian as Endian; +use addr2line::gimli; +use addr2line::gimli::EndianSlice; +use addr2line::gimli::RunTimeEndian as Endian; use memmap2::Mmap; use object::Object as _; use object::ObjectSegment; @@ -173,7 +174,11 @@ impl Symbols { pub fn find_frames( &self, probe: u64, - ) -> Result>, gimli::read::Error> { + ) -> addr2line::LookupResult< + impl addr2line::LookupContinuation< + Output = Result>, gimli::read::Error>, + >, + > { self.context.dwarf.find_frames(probe + self.base_addr()) }