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
This adds a --wasm-debug flag which enables embedding DWARF debug info and rust's normal debug info to enable source maps in the Wasm file.
This can be used by browsers to show the file and line numbers in backtraces and use the Rust source in debuggers.
How to use
Currently I've only figured out how to use this with Chrome (lmk if anyone gets it working with Firefox!)
Warning
Make sure you haven't disabled Rust's debug symbols, don't forget to check your global
~/.cargo/config.toml
.If you don't see
debuginfo
when your build finishes e.g.Finished dev [unoptimized + debuginfo] target(s)
, you will need to re-enable this.This blog post goes over most of these steps with more detail/pictures: https://developer.chrome.com/blog/wasm-debugging-2020/