Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow keeping debug symbols in the generated wasm output in release builds #135

Closed
jbg opened this issue Feb 25, 2021 · 3 comments · Fixed by #154
Closed

Allow keeping debug symbols in the generated wasm output in release builds #135

jbg opened this issue Feb 25, 2021 · 3 comments · Fixed by #154
Labels
assets Build pipelines for specific asset types cli Trunk CLI application enhancement New feature or request

Comments

@jbg
Copy link
Contributor

jbg commented Feb 25, 2021

We're currently looking at improving error reporting from some WebAssembly running in the browser, and we're having trouble getting trunk to produce a .wasm file that includes DWARF debug info. We want to be able to split off that debug info, store it, and use it to symbolicate any reported errors.

Setting debug = true in the release profile in Cargo.toml isn't sufficient because wasm-bindgen-cli strips the debug info when run in release mode unless --keep-debug is passed.

I guess eventually it would be cool if trunk could (optionally) split off the debug info itself and output it separately, but for now it would be sufficient if there was a way to get --keep-debug passed to wasm-bindgen-cli (somewhere around here) and then we can separately run wasm-split afterwards.

@jbg jbg changed the title Allow keeping debug symbols in the generated was in release builds Allow keeping debug symbols in the generated wasm output in release builds Feb 25, 2021
@thedodd thedodd added assets Build pipelines for specific asset types cli Trunk CLI application enhancement New feature or request labels Feb 25, 2021
@thedodd
Copy link
Member

thedodd commented Feb 25, 2021

@jbg that's a good idea. We can actually just add a new option to the Rust asset type pipeline type. Folks would then be able to do something like: <link data-trunk rel="rust" data-keep-debug/>, and then when such an option is specified, we would just pass along the --keep-debug option to wasm-bindgen-cli.

This should be quite simple to add to the pipeline. If you are interested in contributing a PR, that would be excellent. That would get you 90% of the way there. That last bit would be to add some tooling around wasm-split and where to output the debug symbols &c. That could all be passed along as data-* options in the HTML link as well.

@jbg
Copy link
Contributor Author

jbg commented Feb 25, 2021

Cool, sounds like a good approach. I'll take a stab at it tomorrow.

@thedodd
Copy link
Member

thedodd commented Mar 24, 2021

It really seems as though this would be a perfect use case for the plugin system (the wasm-split aspect of this). Especially given that wasm-split does not yet ship pre-compiled, so folks are expected to build it on their own. A plugin for this would be perfect as it is somewhat niche.

thedodd added a commit that referenced this issue Mar 26, 2021
These new data-* options for <link rel="rust" .../> influence the way
that Trunk invokes wasm-bindgen, invoking the --keep-debug &
--no-demangle options respectively.

closes #135
thedodd added a commit that referenced this issue Mar 29, 2021
These new data-* options for <link rel="rust" .../> influence the way
that Trunk invokes wasm-bindgen, invoking the --keep-debug &
--no-demangle options respectively.

closes #135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets Build pipelines for specific asset types cli Trunk CLI application enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants