Skip to content

Commit

Permalink
Don't require a UUID in Mach-O binaries (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
winterqt committed Oct 15, 2021
1 parent 57a9f88 commit 7f14f76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit 7f14f76

Please sign in to comment.