From b5d1131efc1e14b93900cc3ec2ee1839088a5fa4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 4 Dec 2023 13:20:36 -0800 Subject: [PATCH] Update gimli from 0.26.1 to 0.28.1 Summary: This release includes https://github.com/gimli-rs/addr2line/pull/260 which unblocks supporting Split DWARF in reverie and cadaverdog. Separately, ayermolo is looking into whether this gimli update fixes an issue with an iOS test that uses lionhead, and uses gimli to dump debuginfo, which is blocking the land of DWARF5. Reviewed By: jasonwhite Differential Revision: D51814926 fbshipit-source-id: ae0882432019250060c65792476a0f6e296daffb --- reverie/Cargo.toml | 3 +-- reverie/src/backtrace/mod.rs | 17 ++++++++++++++++- reverie/src/backtrace/symbols.rs | 11 ++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) 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()) }