-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Line numbers absent in panic stack traces #1289
Comments
Thanks for the report! Unfortunately this is something we can't currently work around with WebAssembly. There's bits and pieces of source map support for WebAssembly files but we don't think it's quite there yet to support debugging like this. This is definitely on our roadmap for pushing browsers to support though, and we're ensuring that there's support in |
I'm gonna go ahead and close this in the meantime because there's not much we can do to fix it at this time, but once it's possible to do this in browsers we'll be sure to jump on it as quick as we can! |
Any update on this re: https://developers.google.com/web/updates/2019/12/webassembly ? |
All wasm-bindgen modules in debug mode already have dwarf info so should work natively with any developer tools that parse DWARF debug information. Release-mode modules can retain debug information with |
Oh really? I was under the impression that there is still work to be done here given that the author of that article directly pointed to bindgen as an example of something that wont work yet:
|
Oh right yeah, forgot about that! Raw wasm modules work but wasm-bindgen doesn't preserve debuginfo throughout its transformations, so line numbers still aren't available. |
@alexcrichton And what is required from wasm-bindgen to preserve this information? Is it hard to implement? Is it on your roadmap? |
@solomatov the next major piece of work is to get DWARF parsing into |
In addition to the above, the JS stack traces needs to be adjusted, via looking up the .debug_lines custom section. Notice that the JS engines output "index_bg.wasm:wasm-function[222]:0x11dae" or "(wasm-function[222]:34)", and currently don't look up DWARF tables. |
rustwasm/walrus#244 has been merged, perhaps this can be resumed? |
See #3483 for current work on this. |
I am unsure whether this is a bug, a limitation, or me making a mistake somewhere.
Summary
If code panics, I do not get line numbers in the stack trace. I am using the
console_error_panic_hook
crate.Observed output
On Firefox 65, I get the following output:
On Chrome 72, I get the following output:
In both of these, Rust line numbers are absent from the wasm functions. Assuming
get_element
was a large function, how do I tell which line the error came from?Minimal repro
lib.rs:
Cargo.toml:
Compiled with
cargo build
and thenwasm-bindgen --no-modules --no-typescript target/wasm32-unknown-unknown/debug/index.wasm --out-dir target/wasm32-unknown-unknown/debug/
. Served with a simple HTML page:System details
rustc 1.32.0 (9fda7c223 2019-01-16) (Stable)
wasm-bindgen 0.2.37
64-bit Ubuntu 18.04 LTS
The text was updated successfully, but these errors were encountered: