Skip to content

Generate webassemby binary with DWARF information #7503

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

Open
zhuyipeng opened this issue Apr 15, 2025 · 4 comments
Open

Generate webassemby binary with DWARF information #7503

zhuyipeng opened this issue Apr 15, 2025 · 4 comments

Comments

@zhuyipeng
Copy link

zhuyipeng commented Apr 15, 2025

hi, Binaryen,

I am writting a new compiler for a new language, my attention is use binaryen to generate the backend code and use open source Webassembly runtime to run it.

I want to support function of "debugging the source code", this runtime only support debug via lldb with DWARF.

I didn't see any document introduce how to do it. does anyone know how to do it?

Thank you.

@kripken
Copy link
Member

kripken commented Apr 15, 2025

Binaryen does have some limited DWARF support, but it focuses on reading and writing DWARF generated by LLVM (not generating new DWARF), and has known issues.

Binaryen's source maps support is a lot more robust, and recommended.

If you absolutely need DWARF in the final wasm, perhaps a conversion tool could be written from source maps to DWARF? Such a tool exists in the opposite direction,

https://github.com/emscripten-core/emscripten/blob/main/tools/wasm-sourcemap.py

@zhuyipeng
Copy link
Author

@kripken yes, I noticed there is a tool generate dwarf to source map, however no tool in reverse direction.

@quanterion
Copy link

@kripken can you share more about known issues with DWARF?

@kripken
Copy link
Member

kripken commented May 20, 2025

@quanterion binaryen only tracks instruction locations for DWARF, not locals, so we disable passes that change locals. even for instructions, there are reports of the tracking not being perfect, and it is not heavily tested.

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

3 participants