Skip to content

Commit

Permalink
sidecar: Remove usage of deprecated APIs
Browse files Browse the repository at this point in the history
The gimli crate deprecated the Dwarf::borrow() method some time back.
Not using it makes it super inconvenient to support our current
workflow. However, addr2line recently introduced the
Context::from_arc_dwarf() constructor which allows us to keep existing
code structure. Switch over to using it and remove usage of the
deprecated Dwarf::borrow().

Signed-off-by: Daniel Müller <deso@posteo.net>
  • Loading branch information
d-e-s-o committed Sep 30, 2024
1 parent 767e297 commit b6fb614
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
14 changes: 7 additions & 7 deletions sidecar/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sidecar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
addr2line = { version = "0.24.1" }
addr2line = "0.24.2"
gimli = { version = "0.31", default-features = false, features = ["read"] }
glob = "0.3"
fallible-iterator = { version = "0.3", default-features = false }
Expand Down
4 changes: 3 additions & 1 deletion sidecar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::env;
use std::fs::File;
use std::io::{BufRead, Lines, StdinLock, Write};
use std::path::Path;
use std::sync::Arc;

use crate::addr2line::fallible_iterator::FallibleIterator;
use clap::{App, Arg, ArgMatches, Values};
Expand Down Expand Up @@ -471,7 +472,8 @@ fn main() {
dwarf.load_sup(&mut load_sup_section).unwrap();
}

let ctx = Context::from_dwarf(dwarf.borrow(|b| *b)).unwrap();
let dwarf = Arc::new(dwarf);
let ctx = Context::from_arc_dwarf(Arc::clone(&dwarf)).unwrap();

let stdin = std::io::stdin();
let queries = matches
Expand Down

0 comments on commit b6fb614

Please sign in to comment.