macho: fix DWARF in dSYM and sym naming more consistent #8784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With these changes, here's what we get in
lldb
when debugging a Zig program compiled with self-hosted:Note that we successfully print the source file info and the binary itself is devoid of any old-fashioned stab symbols and DWARF info. Instead, we make use of the modern alternative on macOS called the dSYM bundle which is a mirror image of the binary's in-memory layout with relocated DWARF info attached. The beautiful thing about the dSYM bundle is that it doesn't have to reside side-by-side the binary since it is the matching UUID between the binary and dSYM that identifies the pairing, and
lldb
is smart enough to ask Spotlight service to locate the dSYM from the global macOS cache. The tl;dr here is though, Zig's self-hosted is supercharged as we not only provide an incremental (and traditional!) MachO linkers, but now also implement something akin to an in-builtdsymutil
for debugging symbols management.