Skip to content

Commit bd1ff81

Browse files
committed
Don't require a UUID in Mach-O binaries
1 parent 57a9f88 commit bd1ff81

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ jobs:
9191
env:
9292
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: packed
9393
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: packed
94+
# Test that, on macOS, binaries with no UUID work
95+
- run: cargo clean && cargo test
96+
if: matrix.os == 'macos-latest'
97+
env:
98+
RUSTFLAGS: "-C link-arg=-Wl,-no_uuid"
9499

95100
# Test that, on Linux, packed/unpacked debuginfo both work
96101
- run: cargo clean && cargo test

src/symbolize/gimli/macho.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ impl Mapping {
2222
let map = super::mmap(path)?;
2323
let (macho, data) = find_header(&map)?;
2424
let endian = macho.endian().ok()?;
25-
let uuid = macho.uuid(endian, data, 0).ok()??;
25+
let uuid = macho.uuid(endian, data, 0).ok()?;
2626

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

0 commit comments

Comments
 (0)