wasm-pack
wasm-pack copied to clipboard
Source map support?
I use wasm-pack to compile wasm. I am not aware if wasm-bindgen or rustc have sourcemap support because I do not use them directly so I apologize if this is not the right place to ask.
As far as I am aware, emscripten have source map support, as demonstrated in https://github.com/KSXGitHub/wasm-source-map-emscripten.
I'm also interested.
Docs say:
Therefore, debuggers currently provide limited utility, and we end up stepping through raw WebAssembly instructions emitted by the compiler, rather than the Rust source text we authored.
But I don't see why source-maps wouldn't work, givent that they work for emscripten.
+1 this.
+1
It looks like DWARF debugging might be a more interesting approach? Here is another issue about how to make it easier accessible: https://github.com/rustwasm/wasm-pack/issues/1351
Looks like wasm-bindgen
already supports it (but I didn't test it yet).
It looks like DWARF debugging might be a more interesting approach? Here is another issue about how to make it easier accessible: #1351
Looks like
wasm-bindgen
already supports it (but I didn't test it yet).
@haraldreingruber I tried going this route and was still just stepping through assembly code. Any chance you ever got this worked out, it's incredibly frustrating to try and develop with effectively trial and error. From what I can tell you can't even console log to debug from the WASM module.
I will try to test it, and let you know how successful I was.
From what I can tell you can't even console log to debug from the WASM module.
Check out the crate console_log
. We use it for logging from WASM to the browser console.
https://crates.io/crates/console_log
If you use the code on other platforms as well you just have to install another implementation for the log
facade crate for that platform: https://docs.rs/log/latest/log/#available-logging-implementations
For example, we use simplelog
on Windows.