Skip to content

Investigate WebAssembly debug companions and ECMA-426 source maps #703

Description

@mparrett

Background

#624 adds split debug companions for stripped let-go bytecode. A related question is how debugging should work for lg -w WebAssembly builds, including whether we should emit a sister debug asset and whether an ECMA-426 WebAssembly source map could make browser tooling understand let-go sources.

The current WebAssembly path is:

let-go source -> LGB bytecode -> embedded data
                               |
                    Go/TinyGo interpreter -> WebAssembly

The existing debug information maps LGB instruction pointers back to .lg source locations. ECMA-426 WebAssembly maps instead map byte offsets in the generated Wasm binary back to original sources. Because multiple LGB instructions execute through the same interpreter code, the existing mapping cannot simply be converted into a useful .wasm.map.

Investigation

  • Prototype a sister .lgb.debug asset for lg -w -strip.
  • Determine the loader/runtime handshake for fetching the companion and supplying it before LGB decode.
  • Decide naming, inline/external behavior, failure policy, and caching/CORS requirements.
  • Confirm which let-go errors and stack traces the companion can symbolicate.
  • Evaluate what Go and TinyGo expose for WebAssembly source maps and/or DWARF.
  • Determine whether ECMA-426 can meaningfully map the current interpreter-based Wasm output to .lg sources.
  • If not, identify the minimum direct/AOT let-go-to-Wasm compilation needed to produce useful mappings.
  • Compare ECMA-426 source maps with other browser debugging options, including DWARF and runtime-formatted let-go stacks.

Expected outcome

Produce a short design note or proof of concept that separates:

  1. Runtime symbolication for interpreted let-go code using a digest-bound LGB debug companion.
  2. Browser DevTools symbolication for native WebAssembly frames using ECMA-426 and/or DWARF.
  3. Any compiler work required for direct let-go-to-Wasm mappings.

This investigation should not block #624. The likely near-term implementation is the sister LGB debug asset; standards-compatible Wasm source maps are a separate, larger compiler/tooling project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions