Skip to content

Handle supplementary object files #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
rust_channel: ["stable", "beta", "nightly", "1.38.0"]
rust_channel: ["stable", "beta", "nightly", "1.42.0"]
include:
- rust_channel: "stable"
os: "macOS-latest"
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ travis-ci = { repository = "gimli-rs/addr2line" }
[dependencies]
gimli = { version = "0.23", default-features = false, features = ["read"] }
fallible-iterator = { version = "0.2", default-features = false, optional = true }
object = { version = "0.22", default-features = false, features = ["read"], optional = true }
object = { version = "0.23", default-features = false, features = ["read"], optional = true }
smallvec = { version = "1", default-features = false, optional = true }
rustc-demangle = { version = "0.1", optional = true }
cpp_demangle = { version = "0.3", default-features = false, optional = true }
Expand Down
21 changes: 18 additions & 3 deletions examples/addr2line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ fn main() {
)
.required(true),
)
.arg(
Arg::with_name("sup")
.long("sup")
.value_name("filename")
.help("Path to supplementary object file."),
)
.arg(
Arg::with_name("functions")
.short("f")
Expand Down Expand Up @@ -153,10 +159,19 @@ fn main() {

let file = File::open(path).unwrap();
let map = unsafe { memmap::Mmap::map(&file).unwrap() };
let file = &object::File::parse(&*map).unwrap();
let object = &object::File::parse(&*map).unwrap();

let sup_map;
let sup_object = if let Some(sup_path) = matches.value_of("sup") {
let sup_file = File::open(sup_path).unwrap();
sup_map = unsafe { memmap::Mmap::map(&sup_file).unwrap() };
Some(object::File::parse(&*sup_map).unwrap())
} else {
None
};

let symbols = file.symbol_map();
let ctx = Context::new(file).unwrap();
let symbols = object.symbol_map();
let ctx = Context::new_with_sup(object, sup_object.as_ref()).unwrap();

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