Skip to content
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

DWARF Sourcemaps #8934

Closed
Keno opened this issue Jul 7, 2019 · 7 comments
Closed

DWARF Sourcemaps #8934

Keno opened this issue Jul 7, 2019 · 7 comments

Comments

@Keno
Copy link

Keno commented Jul 7, 2019

Firefox supports reading source mapping information directly from the DWARF section in a .wasm file (in fact, it supports that better than regular source maps). Upstream LLVM is already capable of emitting this information and in fact it appears that if debugging information is enabled, emscripten even links the .debug_line section into the final wasm file. In theory, making firefox use this information is as simple as setting the sourceMapUrl section to the wasm file that contains the .debug_line section, though I haven't yet managed to successfully do this with an emscripten-generated .wasm file. Another wrinkle is that binaryen would likely have to be taught to update the debug_line section the same way it updates the regular source map now. In any case, it would be nice to have an emscripten option to use the DWARF directly rather than generating source maps.

@kripken
Copy link
Member

kripken commented Jul 8, 2019

cc @yurydelendik for the latest status here.

@yurydelendik
Copy link
Collaborator

The emscripten relies on binaryen to perform additional code section transforms, such as optimization. The transforming debug information is a hard task, and requires changes in all DWARF sections (not just .debug_line).

I started the https://github.com/yurydelendik/wtmaps-utils project to experiment with that, and it is still work in progress. The idea is to record address spaces transforms, starting from identity source maps (I define that as a "transform") that is generated just after clang creates .wasm. This transform needs to be used with all binaryen passes. And, finally, combine the resulting transform and the initial DWARF to produce the DWARF usable with wasm tools/debuggers. Everything in wtmaps-utils is a pilot code, and help is appreciated.

@Keno
Copy link
Author

Keno commented Dec 3, 2019

Just wanted to check in what the current status is. If there is something minimal we can do, just to get line information, even if we need to disable some binaryen passes that would already be enormously helpful.

@kripken
Copy link
Member

kripken commented Dec 3, 2019

Regular sourcemaps are what works right now.

DWARF sourcemaps depend on WebAssembly/binaryen#2400 which I am working on with @yurydelendik. Specifically, the avenue of using his wtmaps project as a solution is being explored, and emscripten has a wtmaps branch with that integration, but the latest update is yurydelendik/wtmaps-utils#7

@VirtualTim
Copy link
Collaborator

Chrome recently posted a blog post about DWARF in WASM, if you guys are interested: https://developers.google.com/web/updates/2019/12/webassembly

@sbc100
Copy link
Collaborator

sbc100 commented Aug 19, 2020

I guess this can be closed now since -g / -g3 now output full dwarf info?

@kripken
Copy link
Member

kripken commented Aug 19, 2020

That support is not 100% stable, but yes, there are no currently open bugs so I guess we can close this bug. The initial work has all landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants