emscripten-core / emscripten-core/emscripten

Constructing stackTrace with multiple side modules

Open
#20,493 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.35 (a90c5abb489c516f59c0d16864d953d4bedd37da)
clang version 17.0.0 (https://github.com/llvm/llvm-project 6865cff8ea8b07d9f2385fd92cecb422404f0f35)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: ~/3.1.35/emsdk/upstream/bin
```

Currently, if exception is raised in a side-module stacktrace looks like following:
```
'Error: char const*,
at http://localhost:8000/build/test.wasm:wasm-function[150]:0xba67
at wasm://wasm/4feaf742:wasm-function[4]:0x135 <-- side-module function
at _fun4 (http://localhost:8000/build/test.js:4108:30)
at http://localhost:8000/build/test.wasm:wasm-function[17]:0x5384
at http://localhost:8000/build/test.wasm:wasm-function[13]:0x5335
at Module.callFunc (http://localhost:8000/build/test.js:4234:69)
at onmessage (http://localhost:8000/test.js:30:28)'
```

For main-module functions, we have the url to it so we can map its function indices to names using symbol map. For side-modules, there is no such information which side-module the function belongs to. This inhibits constructing stack traces when multiple side modules are present and thus debugging crashes happening in them. Can we have something like https://github.com/WebAssembly/binaryen/pull/3901 that we have for module splitting in which we get wasm name at each function call ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.