Repository navigation
feat(symcache): Build symcaches for WASM modules from Emscripten source maps - #1070
Open
d2anamaria wants to merge 3 commits into
Open
d2anamaria wants to merge 3 commits into
d2anamaria wants to merge 3 commits into
Conversation
- reuse SymCache so native symbolication, caching, and frame shape stay unchanged - reject SourceMapCache: native path has no line/column lookup and still needs the wasm binary for names and bounds - join source map byte offsets to wasm function bodies; map alone cannot define functions - prefer exact body sizes over stretched symbol ranges so padding cannot inherit a line - treat one-field map segments as unmapped holes, not missing source data - parse emscripten length-prefixed build_id so wasm debug_id matches injected map debugId - gate behind wasm-sourcemap; DWARF and existing wasm paths are untouched
- add minimal wasm/map fixtures for padding, holes, and past-end tokens - cover five-field maps with empty vs populated names arrays - reject JS-shaped maps so byte offsets are not treated as wasm addresses - add wasm_sourcemap_debug example for manual lookup on local wasm/map pairs
- keep raw custom-section payload so debug_id matches @sentry/wasm at runtime - stripping the ULEB128 prefix would file uploads under a different id than events - delete parse_build_id and its five unit tests; no callers remain
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Build symcaches for WASM modules from Emscripten source maps ([#1070](https://github.com/getsentry/symbolic/pull/1070))If none of the above apply, you can opt out of this check by adding |
Contributor
|
Once #1081 is merged the logic for preserving exact function sizes will be unnecessary (it will just work that way in general). |
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
Emscripten can ship a Source Map v3 file next to a
.wasmmodule instead of DWARF. This changeturns such a module plus its map into a SymCache, so WASM builds without DWARF become
symbolicatable. Everything sits behind the
wasm-sourcemapfeature flag, which keeps thesourcemapdependency out of the way for consumers that don't need it.Nothing calls this yet. The
symbolicatorwiring is a follow-up.Why a source map works as debug info
An Emscripten WASM map abuses the source map format:
0Why SymCache
That byte offset is already a symcache key.
SourceMapCacheis keyed by a line and a columninstead, so using it would mean faking a position and unwinding it on every lookup. Reusing SymCache
means WASM frames flow through the existing address lookup path, with no new format and no new
lookup API.
Inputs
.wasmmodule is required, not optional. A map has no notion of a function.What lands in the cache
stops a lookup from bleeding into the previous function.
wasm-function[<index>], matching what browsers show.inheriting the location before it.
WASM object changes
Exact function body bounds and WASM function indices are now available. The existing symbol
iteration stretches each body to be contiguous with the next, hiding the padding between bodies.
Joining a map to stretched bounds would let padding inherit a line from the function before it.
Debug ids are out of scope
This change derives no identifier. It reads
WasmObject::debug_id()as-is.An earlier revision also made the
build_idcustom section length-prefix aware, per thetool convention. That is
correct in isolation but breaks matching:
@sentry/wasmreads the same section without strippingthe prefix, so a corrected reader here would file uploads under an id no event carries. The parsing
change was removed and the whole question moved to
#1069, which needs a coordinated decision
across
symbolic, the SDK, and the CLI.Whichever way that lands, this change needs no rework — the embedded id follows
debug_id()automatically.
Limitations