-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Local variable names lost while debugging #1496
Comments
That's expected. Unfortunately browsers can't do this. WebAssembly has proposal which should fix this: Or we still need wait when browsers began support DWARF sections. |
Hm, Chrome and Firefox support DWARF, and binaryen seems to have support for it (WebAssembly/binaryen#2400). Is this a limitation of binaryen then? Or could it be that asc doesn't enable DWARF output in binaryen? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
If you'll pardon me, I would like this issue reopened. I'm really interested in debugging a wasm module compiled with asc in a runtime other than the browser, like wasmtime. It's not clear to me whether asc emits DWARF info then? So would it be debuggable with gdb or lldb? @MaxGraey any thoughts? |
AssemblyScript doesn't emit DWARF yet. Actually it should provide by Binaryen which has some limited support of DWARF but only for transform DWARF debug info and also in very limit way (many optimization passes doesn't handle dwarf data and turned off when dwarf section present). So, first of all, we need to ensure the full support of DWARF for Binaryen |
@MaxGraey do the optimization passes that are turned off for DWARF, actually prevent us from exploring this avenue at all? This comment actually hints the opposite of what you're suggesting, so I wonder if it's worth it giving this a try and if it works maybe adding DWARF support as experimental to the compiler. One of the main reasons why I think that having support for debug symbols is important is because observability and debugging of WASM modules in large, server-side systems is not feasible. Ideally, we could take advantage of the DWARF support in FF/Chrome and build tools to allow developers to debug their modules locally, which would give them an extra layer of confidence when testing their modules. The other option is to stick with source maps, which are definitely better than dealing with raw traps. @dcodeIO I'm curious to know what's your take on this. |
Generating a DWARF section is definitely something I'd like to explore but don't know when I'll get to it. Information I have from the Binaryen side of things is that, in the current state, Binaryen only implements the pieces of DWARF that are relevant to pipe it through, and it may not be feasible to add a Binaryen API to more conveniently generate DWARF yet, so if we want that we'd need to generate a "line table" (that one was mentioned) etc. on our own and attach the debug section with A little less sophisticated alternative that may be a good start however may be to utilize Binaryen's C API to set local names (that is available already but we don't use it yet), which I so far attempted but found that
Help appreciated :) |
Check source code for optimization pipeline: As you can see all passes have |
Thanks for the detailed explanation @dcodeIO. And apologies @MaxGraey I misunderstood your comment. Just to clarify a bit my point, yeah I only meant exploring this for In any case, thanks for the pointers, I think this summarizes the state of DWARF support pretty well. |
Do you think this is something that would be happening in the "near future" like within a year, or something that is more than a year down the road? @dcodeIO maybe you could share your feelings on that? |
I guess this issue should be fixed in |
Local variables appear as
var0
,var1
, etc. in the debugger (Chrome).The text was updated successfully, but these errors were encountered: