I am testing a simple todo app in Rust using the YEW framework. When I get an error, the browser console (Devmode) shows JavaScript or assembler (I tried both Chrome and Firefox). How can I get the Rust code? Do I have to setup source maps somewhere?
2 Answers
To achieve this you’d need WebAssembly to support sourcemaps. This is something that is being considered for future tooling, but I don’t think much progress has been made yet.
There is also an open issue for Rust sourcemap support
2 Comments
Shepmaster
In OPs cross-posted question, they claim that it's already possible.
joe
Seems that the issue you linked has been closed. Relevant/related links: github.com/WebAssembly/debugging | medium.com/oasislabs/webassembly-debugging-bec0aa93f8c6 | github.com/rustwasm/team/issues/26
This is possible now for C++. See this post. You need to install this extension and pass -g to generate debug info when compiling the C++.
Unfortunately it doesn't work in Rust yet (at least if you're using wasm-bindgen which you probably are) because wasm-bindgen discards all the DWARF info. See this post and this linked issue.
@FirefoxNightly'sJavaScript Debugger supports debugging & source maps for@rustlangin#WebAssemby-compiledweb code!@slsoftworks14 Dec 2017 afaict you just just emscripten (not the direct rustc wasm backend) and it just works. /cc@yurydelendik@jasonlaster11@kripken`