Skip to content
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

Don't require a UUID in Mach-O binaries #446

Merged
merged 1 commit into from
Oct 15, 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
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ jobs:
env:
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: packed
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: packed
# Test that, on macOS, binaries with no UUID work
- run: cargo clean && cargo test
if: matrix.os == 'macos-latest'
env:
RUSTFLAGS: "-C link-arg=-Wl,-no_uuid"

# Test that, on Linux, packed/unpacked debuginfo both work
- run: cargo clean && cargo test
Expand Down
10 changes: 6 additions & 4 deletions src/symbolize/gimli/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ impl Mapping {
let map = super::mmap(path)?;
let (macho, data) = find_header(&map)?;
let endian = macho.endian().ok()?;
let uuid = macho.uuid(endian, data, 0).ok()??;
let uuid = macho.uuid(endian, data, 0).ok()?;

// Next we need to look for a `*.dSYM` file. For now we just probe the
// containing directory and look around for something that matches
// `*.dSYM`. Once it's found we root through the dwarf resources that it
// contains and try to find a macho file which has a matching UUID as
// the one of our own file. If we find a match that's the dwarf file we
// want to return.
if let Some(parent) = path.parent() {
if let Some(mapping) = Mapping::load_dsym(parent, uuid) {
return Some(mapping);
if let Some(uuid) = uuid {
if let Some(parent) = path.parent() {
if let Some(mapping) = Mapping::load_dsym(parent, uuid) {
return Some(mapping);
}
}
}

Expand Down