Generate webassemby binary with DWARF information
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.
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
@kripken yes, I noticed there is a tool generate dwarf to source map, however no tool in reverse direction.
@kripken can you share more about known issues with DWARF?
@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.