-
Notifications
You must be signed in to change notification settings - Fork 10
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
Backtrace with SourceSpan #19
Comments
I think there hasn't been too much appetite for this (i.e. a standardized way to specify source-mapping information) so far mostly because source maps and DWARF have worked well enough. It's not completely ideal, and there are some known deficiencies (e.g. the fact that sourcemap's line/column format doesn't map perfectly to wasm's binary format, and the fact that DWARF can't currently assign source information to constant initializers), but it works well enough for many use cases. I think it would be pretty straightforward to document a text syntax something like your example using the annotations proposal, and perhaps a binary equivalent using the compilation hints proposal. It could be useful for use cases where DWARF or sourcemaps aren't a good fit, but it would be unlikely to replace them for cases where they are already used. It wouldn't need to go through the full formal process to be useful; it could end up as a document in the tool-conventions. |
Another tricky bit is that the debug info can be split out from the debuggee artifact and might require e.g. fetching the debug info over the network. In the context of a JS embedding of Wasm, does this mean that the trap (and the associated JS error message) should block on that network request? Or would it be nondeterministic whether you get Wasm-level information or source-level information? Or would there be a new method that returns a promise of an error message with source-level information? |
There seems to be no tool that can debug at the wat level. If you switch to wasm, all redundant information will be erased and the source location will also need to be remapped. |
@oovm I'm not sure what you mean by "debug at the wat level", but binaryen has support for source annotations in wat files using JS-style ;;@ src.cpp:200:2
(local.set $temp
..
) That means that Those are equivalent to source maps, but can be embedded in the wat. |
Is it possible to append source span information to generate a backtrace that jumps to the source language?
Assume the following syntax:
Then the following log will be generated during trap, and the IDE can recognize and generate a local link:
It seems that the browser can use source-map or DWARF, but this is not part of the wasm standard, and it does not fit the features of wasm very well.
Should the wasm standard define a standardized set of debugger metainfo?
The text was updated successfully, but these errors were encountered: