Skip to content

[dart2wasm] Debugging information for release builds (e.g. dwarf, source maps) #55229

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

Closed
mkustermann opened this issue Mar 18, 2024 · 3 comments
Assignees
Labels
area-dart2wasm Issues for the dart2wasm compiler.

Comments

@mkustermann
Copy link
Member

mkustermann commented Mar 18, 2024

For release builds we are stripping the static name section from the wasm by-default. For local debugging one can compile with name section included (e.g. flutter build web --wasm --no-strip-wasm) but apps are usually deployed without symbols to reduce the wasm file size.

This means stack traces at runtime are non-symbolic. There's several ways one could get symbolic stack traces:

  • Make stripping the name section a separate pass, remember the mapping, provide offline decoding tool
  • Emit source maps in the compiler, which binaryen preserves across optimizations
  • Emit dwarf in the compiler, which binaryen may preserve to some extent

I stumbled upon this code in the binaryen sources in pass.cpp:

void PassRunner::addDefaultFunctionOptimizationPasses() {
  // All the additions here are optional if DWARF must be preserved. That is,
  // when DWARF is relevant we run fewer optimizations.
  // FIXME: support DWARF in all of them.
  ...

Because of that, I think we should avoid DWARF for the time being and instead emit source maps.

@mkustermann mkustermann added the area-dart2wasm Issues for the dart2wasm compiler. label Mar 18, 2024
@mkustermann
Copy link
Member Author

/cc @osa1

@osa1 osa1 self-assigned this Apr 4, 2024
@osa1
Copy link
Member

osa1 commented Apr 4, 2024

I started working on generating source maps.

@mkustermann
Copy link
Member Author

The source map support has landed now in 10742d9. Closing this issue.

I'll file another issue with some follow-up tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler.
Projects
None yet
Development

No branches or pull requests

2 participants