feat(symbols): Apple dSYM upload (dsymmap)#747
Open
abelonogov-ld wants to merge 2 commits into
Open
Conversation
Rename the symbol-map package/format from ldsm to dsymmap (magic DSMP), append the .dsymmap extension to the apple upload key, and accept apple/ios/dsym aliases for the --type flag. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR extends ldcli symbols to support Apple dSYM uploads by compiling DWARF-in-dSYM Mach-O images into a compact .dsymmap format (magic DSMP) keyed by image UUID, aligning with the backend’s Apple crash symbolication pipeline.
Changes:
- Adds the
internal/symbols/applepipeline to extract UUID/CPU info, walk DWARF for functions/lines/inlines, demangle names, and normalize to image-relative addresses. - Introduces the
.dsymmapbinary format (builder + mmap-friendly reader/lookup) underinternal/symbols/dsymmap. - Updates the CLI to accept Apple dSYM
--typealiases (canonicalized toapple-dsym) and addssymbols generateto write symbol outputs locally using backend storage-key layout.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/symbols/dsymmap/dsymmap.go | New .dsymmap binary format encoder/decoder and lookup implementation. |
| internal/symbols/apple/dsym.go | New DWARF/Mach-O processing to build per-arch .dsymmap builders keyed by UUID. |
| internal/symbols/apple/dsym_test.go | Unit tests validating UUID extraction and inline-chain symbolication via encode→open→lookup. |
| internal/symbols/apple/testdata/symbolsdemo.dSYM/Contents/Resources/Relocations/x86_64/symbolsdemo.yml | Test fixture metadata for the universal dSYM. |
| internal/symbols/apple/testdata/symbolsdemo.dSYM/Contents/Resources/Relocations/aarch64/symbolsdemo.yml | Test fixture metadata for the universal dSYM. |
| internal/symbols/apple/testdata/symbolsdemo.dSYM/Contents/Info.plist | Test fixture bundle plist for the checked-in dSYM. |
| internal/symbols/apple/testdata/symbolsdemo.cpp | Fixture source used to produce the checked-in dSYM (inline-chain behavior). |
| internal/symbols/apple/testdata/build.sh | Script to regenerate the checked-in dSYM fixture (not invoked by tests). |
| cmd/symbols/upload.go | Adds apple-dsym support, --type canonicalization/aliases, and routes Apple uploads via a dedicated path. |
| cmd/symbols/upload_test.go | Updates unsupported-type test and adds tests for canonicalization and supported-type set. |
| cmd/symbols/symbols.go | Registers the new symbols generate subcommand. |
| cmd/symbols/generate.go | New command to generate symbol artifacts locally using backend-compatible storage keys. |
| cmd/symbols/apple_upload.go | New Apple dSYM discovery/build/upload logic producing per-UUID .dsymmap uploads. |
| cmd/symbols/apple_upload_test.go | Tests for keying, discovery, map building/deduplication, and generated bytes decoding as .dsymmap. |
| go.mod | Adds Mach-O/DWARF and demangling dependencies required for Apple dSYM processing. |
| go.sum | Adds checksums for the new dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+435
to
+455
| func (m *Map) coveringInlines(rel uint64, off, count uint32) []int { | ||
| if count == 0 { | ||
| return nil | ||
| } | ||
| var out []int | ||
| for j := uint32(0); j < count; j++ { | ||
| idx := int(off + j) | ||
| s, en, _, _, _, _ := m.inlineAt(idx) | ||
| if rel >= s && rel < en { | ||
| out = append(out, idx) | ||
| } | ||
| } | ||
| // Records are stored depth-ascending within a func group, so out is already | ||
| // ordered outermost..innermost; sort defensively in case a producer differs. | ||
| sort.Slice(out, func(a, b int) bool { | ||
| _, _, _, _, _, da := m.inlineAt(out[a]) | ||
| _, _, _, _, _, db := m.inlineAt(out[b]) | ||
| return da < db | ||
| }) | ||
| return out | ||
| } |
Vadman97
approved these changes
Jul 22, 2026
Vadman97
left a comment
Contributor
There was a problem hiding this comment.
lgtm pending addressing bot comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ldcli symbolssupport for Apple dSYMs: converts a dSYM's DWARF into a compact.dsymmapsymbol map (functions, lines, inline frames, string table) and uploads it keyed by image UUID.dsymmappackage/format (magicDSMP), replacing the earlierldsmname, and appends the.dsymmapextension to the upload key.--typealiases (ios,ipados,tvos,watchos,visionos,macos,apple,dsym) canonicalized toapple-dsym.Test plan
go test ./...ldcli symbols upload --type ios ...produces and uploads a.dsymmapapple-dsymMade with Cursor