Skip to content

Commit

Permalink
sidecar: Update addr2line dependency to 0.21
Browse files Browse the repository at this point in the history
This change updates the addr2line dependency to 0.21. To prevent version
mismatch, also update gimli to 0.28, as it's part of addr2line's public
API surface and needs to match what retsnoop itself uses, because
objects are exchanged.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and anakryiko committed Dec 15, 2023
1 parent 9dc72e1 commit a12c501
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 49 deletions.
153 changes: 111 additions & 42 deletions sidecar/Cargo.lock

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

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

[dependencies]
addr2line = { version = "0.18", features=["std-object"] }
gimli = { version = "0.26", default-features = false, features = ["read"] }
addr2line = { version = "0.21", features=["std-object"] }
gimli = { version = "0.28", default-features = false, features = ["read"] }
glob = "0.3"
fallible-iterator = { version = "0.3", default-features = false }
memmap = "0.7"
Expand Down
9 changes: 4 additions & 5 deletions sidecar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn query_address<T: gimli::Endianity>(

if config.do_functions || config.do_inlines {
let mut printed_anything = false;
let mut frames = ctx.find_frames(probe).unwrap().enumerate();
let mut frames = ctx.find_frames(probe).skip_all_loads().unwrap().enumerate();
while let Some((i, frame)) = frames.next().unwrap() {
if config.pretty && i != 0 {
print!(" (inlined by) ");
Expand Down Expand Up @@ -243,11 +243,10 @@ fn query_address<T: gimli::Endianity>(
//
fn query_compile_unit<T: gimli::Endianity>(
compile_unit: &str,
ctx: &Context<gimli::EndianSlice<T>>,
dwarf: &gimli::Dwarf<gimli::EndianSlice<T>>,
_config: &Config,
) {
let cu_pattern = glob::Pattern::new(compile_unit).unwrap();
let dwarf = ctx.dwarf();
let mut units = dwarf.units();
while let Some(header) = units.next().expect("fail to parse units") {
let unit = dwarf.unit(header).expect("fail to parse header");
Expand Down Expand Up @@ -438,7 +437,7 @@ fn main() {
dwarf.load_sup(&mut load_sup_section).unwrap();
}

let ctx = Context::from_dwarf(dwarf).unwrap();
let ctx = Context::from_dwarf(dwarf.borrow(|b| *b)).unwrap();

let stdin = std::io::stdin();
let queries = matches
Expand All @@ -450,7 +449,7 @@ fn main() {
match addr_or_cunit {
QueryType::Addr(probe) => query_address(probe, &ctx, &symbols, &config),
QueryType::CompileUnit(compile_unit) => {
query_compile_unit(&compile_unit, &ctx, &config)
query_compile_unit(&compile_unit, &dwarf, &config)
}
_ => panic!("not implemented yet"),
}
Expand Down

0 comments on commit a12c501

Please sign in to comment.