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

wasm: add DWARF sections #33503

Open
walkingeyerobot opened this issue Aug 6, 2019 · 10 comments
Open

wasm: add DWARF sections #33503

walkingeyerobot opened this issue Aug 6, 2019 · 10 comments

Comments

@walkingeyerobot
Copy link

@walkingeyerobot walkingeyerobot commented Aug 6, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.5 linux/amd64

Output source maps for use with browser developer tools to enable simple step debugging inside browsers. Details of the spec can be found here: https://sourcemaps.info/spec.html

@dmitshur dmitshur changed the title wasm feature request: output source maps wasm: output source maps Aug 6, 2019
@dmitshur dmitshur added this to the Unplanned milestone Aug 6, 2019
@agnivade
Copy link
Contributor

@agnivade agnivade commented Aug 7, 2019

If I am reading the link correctly, it is the spec for JS source maps. Wasm source maps are not part of a specification yet and it is still in progress. Discussion is ongoing here - WebAssembly/design#1051.

@walkingeyerobot
Copy link
Author

@walkingeyerobot walkingeyerobot commented Aug 7, 2019

It's the spec for sourcemaps within browser dev tools, not specific to javascript. Emscripten is already capable of outputting these for c++ compiled to wasm. See their docs at https://emscripten.org/docs/porting/Debugging.html for more detail.

@agnivade
Copy link
Contributor

@agnivade agnivade commented Aug 7, 2019

I see. Thanks.

@torbenschinke
Copy link
Contributor

@torbenschinke torbenschinke commented Jun 2, 2020

Meanwhile Chrome got native dwarf-support for wasm-files, see [1]. It could be a better / simpler alternative to embed debug symbols into the wasm file directly.

Also, one can derive source maps from embedded symbols using tools like [2]. So a dwarf support may be sufficient.

It looks like gc does not embed those symbols currently? Do you have any insights?

[1] https://developers.google.com/web/updates/2019/12/webassembly#enter_dwarf
[2] https://chromium.googlesource.com/external/github.com/kripken/emscripten/+/1.38.11/tools/wasm-sourcemap.py

@jeremyfaller
Copy link
Contributor

@jeremyfaller jeremyfaller commented Jun 2, 2020

The linker explicitly strips DWARF from generated wasm binaries. I would need to about the wasm binary format to add support for DWARF, but it's probably entirely doable to just tweak the linker to spit out DWARF.

@torbenschinke
Copy link
Contributor

@torbenschinke torbenschinke commented Jun 3, 2020

Yury Delendik has summarized his findings in [1] and it looks like each DWARF section has a custom section within the wasm binary, just like it shall be in ELF binaries.

[1]https://yurydelendik.github.io/webassembly-dwarf/

@torbenschinke
Copy link
Contributor

@torbenschinke torbenschinke commented Jun 5, 2020

@jeremyfaller Are you planning to work on adding support for DWARF?

@jeremyfaller
Copy link
Contributor

@jeremyfaller jeremyfaller commented Jun 5, 2020

Yeah, I'll take a look. It won't make 1.15 (that's frozen), but I'll put something together (on master) that can make 1.16.

@jeremyfaller
Copy link
Contributor

@jeremyfaller jeremyfaller commented Sep 1, 2020

This is looking less likely for me to get to for 1.16. I'm being lent over to the COVID exposure notification work. I would be happy to do code reviews for anyone that takes over. For now, I'm un-committing myself to delivering for 1.16.

@haselkern
Copy link

@haselkern haselkern commented Sep 8, 2020

Hi @jeremyfaller! I would be willing to put some time and effort into this. Could you give me a quick rundown of what would need to be done to make this work?

@neelance neelance changed the title wasm: output source maps wasm: add DWARF sections Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.