Skip to content

feat(symbols): upload Swift/ObjC sources with dSYMs (--include-sources)#757

Open
abelonogov-ld wants to merge 12 commits into
mainfrom
andrey/apple-source
Open

feat(symbols): upload Swift/ObjC sources with dSYMs (--include-sources)#757
abelonogov-ld wants to merge 12 commits into
mainfrom
andrey/apple-source

Conversation

@abelonogov-ld

Copy link
Copy Markdown
Contributor

Adds an opt-in --include-sources to ldcli symbols upload --type apple-dsym, which packs the source files an image's DWARF references into a .srcbundle and uploads it beside the .dsymmap. The backend then renders the code around each symbolicated frame instead of just file:line.

Stacks on #756 — merge that first and this diff reduces to the source-bundle work.

_sym/apple/id/<UUID>.dsymmap     # existing symbol map
_sym/apple/id/<UUID>.srcbundle   # new, same key

What this adds

  • internal/symbols/srcbundle — the Source Bundle format: header, an index sorted by path for binary search, a string table, and per-file gzip streams. Mirrors .dsymmap's ethos and is byte-for-byte identical to the backend copy, with the same Magic/Version drift guard. Per-file compression means the backend inflates exactly one file to answer a frame, not the archive.
  • Source collection — the existing DWARF walk now also records every source path it sees, from both line rows and inline call sites, resolving relative paths against the CU's DW_AT_comp_dir.
  • --include-sources on both symbols upload and symbols generate.

The key invariant

Files are keyed by the exact path string the sibling .dsymmap stores, because both artifacts are produced from one DWARF pass. A resolved frame's file name is therefore the lookup key, with no path normalization on either side.

Safety and opt-in

Off by default, because it ships your source to LaunchDarkly; the flag help says so explicitly.

Packing skips anything not readable locally (SDK and system sources, or a dSYM archived on another machine), anything over 2 MiB, and any extension the UI can't render. If nothing local turns up it prints a note and uploads the map alone, so --include-sources never breaks an upload that would otherwise succeed.

Testing

./cmd/symbols/... and ./internal/symbols/... pass. New tests cover the format round trip, window clamping at file edges, files without a trailing newline, truncated/garbage input, keying by DWARF path rather than local path, skipping unreadable and oversize files, and that the real fixture dSYM (whose sources aren't on this machine) degrades to map-only instead of failing.

Verified end to end against a real iOS Release build.

Made with Cursor

abelonogov-ld and others added 12 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>
Parse Flutter ELF app.<arch>.symbols files (debug/elf + debug/dwarf), extract
the Dart build id (.note.gnu.build-id) and DWARF, and compile them into the
compact .dartmap symbol map (dsymmap codec). Upload to the Symbols Id lane
(keyed by build id) and the Version lane (version + platform), and support
local generation via `symbols generate`.

Co-authored-by: Cursor <cursoragent@cursor.com>
Parse Flutter ELF app.<arch>.symbols files (debug/elf + debug/dwarf), extract
the Dart build id (.note.gnu.build-id) and DWARF, and compile them into the
compact .dartmap symbol map (dsymmap codec). Upload to the Symbols Id lane
(keyed by build id) and the Version lane (version + platform), and support
local generation via `symbols generate`.

Co-authored-by: Cursor <cursoragent@cursor.com>
…y/ldcli into andrey/flutter-symbols

* 'andrey/flutter-symbols' of ssh://github.com/launchdarkly/ldcli:
  feat(symbols): add Flutter (Dart AOT) symbol upload (--type flutter)
  panic fix
  fix demagling
  refactor(symbols): rename ldsm to dsymmap + apple type aliases
  apple dsym ingest
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.

1 participant