Skip to content

feat(symbols): Apple dSYM upload (dsymmap)#747

Open
abelonogov-ld wants to merge 2 commits into
mainfrom
andrey/apple-symbols
Open

feat(symbols): Apple dSYM upload (dsymmap)#747
abelonogov-ld wants to merge 2 commits into
mainfrom
andrey/apple-symbols

Conversation

@abelonogov-ld

Copy link
Copy Markdown
Contributor

Summary

  • Adds ldcli symbols support for Apple dSYMs: converts a dSYM's DWARF into a compact .dsymmap symbol map (functions, lines, inline frames, string table) and uploads it keyed by image UUID.
  • Introduces the dsymmap package/format (magic DSMP), replacing the earlier ldsm name, and appends the .dsymmap extension to the upload key.
  • Accepts friendly --type aliases (ios, ipados, tvos, watchos, visionos, macos, apple, dsym) canonicalized to apple-dsym.
  • Includes dSYM test fixtures and unit tests.

Test plan

  • go test ./...
  • ldcli symbols upload --type ios ... produces and uploads a .dsymmap
  • Verify aliases resolve to apple-dsym

Made with Cursor

abelonogov-ld and others added 2 commits July 21, 2026 19:16
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/apple pipeline to extract UUID/CPU info, walk DWARF for functions/lines/inlines, demangle names, and normalize to image-relative addresses.
  • Introduces the .dsymmap binary format (builder + mmap-friendly reader/lookup) under internal/symbols/dsymmap.
  • Updates the CLI to accept Apple dSYM --type aliases (canonicalized to apple-dsym) and adds symbols generate to 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 Vadman97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending addressing bot comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants