diff --git a/Cargo.toml b/Cargo.toml index 986dc62056e22329e04613366583ebce6c92412c..4bab46a451ad6a5eeacaea03c0fe26e66caaf35c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dwarf2sources" -version = "0.1.1" +version = "0.2.0" authors = ["Sjoerd Simons <sjoerd@collabora.com>"] edition = "2018" @@ -9,9 +9,9 @@ edition = "2018" anyhow = "1.0" serde = { version = "1", features = ["derive"] } serde_json = "1.0" -gimli = "0.16" -fallible-iterator = "0.1" +gimli = "0.19" +fallible-iterator = "0.2" memmap = "0.7" -object = { version = "0.11", features = [ "std", "compression" ] } +object = { version = "0.12", features = [ "std", "compression" ] } typed-arena = "2" -structopt = "0.2" +structopt = "0.3" diff --git a/debian/control b/debian/control index 88ad0043295989f0787c8578b3f3c61ee89da20e..2cc5a7e450a73814881f5929caadfe6993264b51 100644 --- a/debian/control +++ b/debian/control @@ -7,12 +7,12 @@ Build-Depends: debhelper-compat (= 12), dh-cargo, librust-anyhow-1-dev, librust-fallible-iterator-0-dev, - librust-gimli-0+default-dev (>= 0.16), + librust-gimli-0+indexmap-dev (>= 0.19), librust-memmap-0-dev (>= 0.7), - librust-object-0+default-dev (>= 0.11), + librust-object-0+default-dev (>= 0.12), librust-serde-1+derive-dev, librust-serde-json-1-dev, - librust-structopt-0+default-dev (>= 0.2), + librust-structopt-0+default-dev (>= 0.3), librust-typed-arena-2-dev Standards-Version: 4.5.0 Homepage: https://gitlab.apertis.org/pkg/dwarf2sources diff --git a/debian/patches/relax-deps.patch b/debian/patches/relax-deps.patch index 1ba586d085a6a148f9b085ce2576b02dc2f9bdb8..88e3eda7ed6118e61baecb201df22d60ded04cc9 100644 --- a/debian/patches/relax-deps.patch +++ b/debian/patches/relax-deps.patch @@ -4,13 +4,13 @@ anyhow = "1.0" serde = { version = "1", features = ["derive"] } serde_json = "1.0" --gimli = "0.16" --fallible-iterator = "0.1" -+gimli = ">= 0.16" +-gimli = "0.19" +-fallible-iterator = "0.2" ++gimli = ">= 0.19" +fallible-iterator = "0" memmap = "0.7" --object = { version = "0.11", features = [ "std", "compression" ] } -+object = { version = ">= 0.11", features = [ "std", "compression" ] } +-object = { version = "0.12", features = [ "std", "compression" ] } ++object = { version = ">= 0.12", features = [ "std", "compression" ] } typed-arena = "2" --structopt = "0.2" -+structopt = ">= 0.2" +-structopt = "0.3" ++structopt = ">= 0.3" diff --git a/src/main.rs b/src/main.rs index f911a380f77aa2a6cc580a708181fed69f0cf488..79354139e66dd176a66bb5e891b4f6bb667d2b97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ // Based on the gimli 0.16.1 dwarfdump.rs example use anyhow::{anyhow, Error, Result}; use fallible_iterator::{convert, FallibleIterator}; -use gimli::{Endianity, Reader}; +use gimli::{AttributeValue, Endianity, Reader}; use object::Object; use serde::ser::SerializeMap; use serde::{Serialize, Serializer}; @@ -81,17 +81,29 @@ fn list_entries<R: Reader>( .map::<Result<String>, _>(|s| Ok(s.to_string()?.into_owned())) .transpose()? .ok_or_else(|| anyhow!("Missing DW_AT_comp_dir"))?; - let comp_name = entry + + let at_name = entry .attr(gimli::DW_AT_name)? - .and_then(|attr| attr.string_value(debug_str)) - .map::<Result<String>, _>(|s| Ok(s.to_string()?.into_owned())) - .transpose()? .ok_or_else(|| anyhow!("Missing DW_AT_name"))?; - v.push(Unit { - comp_dir, - comp_name, - }); + if let Some(r) = at_name.string_value(debug_str) { + let comp_name = r.to_string()?; + if comp_name == "<artificial>" { + eprintln!("Warning: Artificial name in compile unit, probably DWARF debug information has been generated with LTO") + } else { + v.push(Unit { + comp_dir, + comp_name: comp_name.into_owned(), + }); + } + } else { + match at_name.raw_value() { + AttributeValue::DebugStrRefSup(_) => { + eprintln!("Warning: compilation unit name in supplemental file") + } + _ => eprintln!("Warning: compilation unit has unexpected name type"), + } + } } } Ok(v)