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

Creating DWARF debug info #5786

Closed
weichx opened this issue Jun 27, 2023 · 2 comments
Closed

Creating DWARF debug info #5786

weichx opened this issue Jun 27, 2023 · 2 comments

Comments

@weichx
Copy link

weichx commented Jun 27, 2023

I'm a compiler writer and exploring using binaryen as the backend for a new language I am working on (not going through llvm). I'm trying to figure out how to make this debuggable. I have line/column/file info already and I see (using the c-api) that I can set expression offsets and generate source maps. That's working just fine. However, except for browsers, every wasm runtime I've seen only supports DWARF for debugging. Is there a way to emit the DWARF info with binaryen? Maybe I'm missing something but I can't figure out how to generate it. Could someone either tell me if this is not supported though it looks like it is after reading through this issue, or provide a hello world style example of how this can be done?

@kripken
Copy link
Member

kripken commented Jun 27, 2023

Binaryen has some DWARF support, but limited, and focused only on passing through and rewriting DWARF as needed.

Instead, what I'd recommend is this:

  1. Use source maps in Binaryen.
  2. Use a tool to convert source maps to DWARF for wasm runtimes that only support DWARF.

The second tool might already exist - I think I've heard of one - but I'm not sure offhand (the opposite direction definitely exists already, and is not that complex, so hopefully source maps to DWARF could be simple as well).

@weichx
Copy link
Author

weichx commented Jun 28, 2023

Thanks for the clarification, I'll look into that.

@weichx weichx closed this as completed Jun 28, 2023
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

2 participants