-
-
Notifications
You must be signed in to change notification settings - Fork 1.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. |
AFAICT everything's merged here, and it's been a bit more than half a year so I assume it's all been released, but I'm still getting backtraces with no line numbers. What's required to use this feature (flag on cargo or wasm-bindgen, helper crates, special invocations, etc)? And also, what's not required to use this feature (i.e. is Sorry if this is off topic - read the linked MRs but couldn't get a feel of the big picture implications. Maybe discussion is continuing somewhere else? FWIW, sans-console-panic-error-hook I just get
I'm not sure what the With
plus the above. |
See #3698. Browsers don't support DWARF, Chrome has some support, but requires an extension. You have to convert your DWARF into source maps, which all browsers support. There are various tools for that, I use Let me know if this helps! |
Ah thanks, that was exactly what I was missing! |
if someone is looking for a way to use it: #3698 (comment) |
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: