You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, both in Emscripten and Wasm EH, if you throw an exception, stack traces are not attached by default. This was, at least for Wasm EH, an intentional decision, because Wasm exception itself can be used not only for errors but for other control flow structures with which slowdown can be problematic. Native C++ exceptions don't have stack traces either.
But it is still convenient to see stack traces when debugging. I think we can attach stack traces when in debug / assert mode, by throwing an Error object instead of a raw string in case of Emscripten EH, and turning the optional traceStack option on in the JS API for Wasm EH.
I think I can make this work for Wasm EH, but I'm not sure if the same is possible for Emscripten EH. If we throw a JS Error object in Emscripten EH, that's not going to be recognized as a C++ exception in our wasm code... Maybe we should only solve this for Wasm EH and recommend people to use it more.
+1 for fixing only in Wasm EH. Even if people can't ship with it yet on all browsers, for local debugging a developer can use a recent browser with Wasm EH.
Activity
aheejin commentedon Sep 30, 2022
I think I can make this work for Wasm EH, but I'm not sure if the same is possible for Emscripten EH. If we throw a JS
Errorobject in Emscripten EH, that's not going to be recognized as a C++ exception in our wasm code... Maybe we should only solve this for Wasm EH and recommend people to use it more.[-][EH] Stack trace support for Emscripten / Wasm EH[/-][+][EH] Stack trace support for Wasm EH[/+]kripken commentedon Sep 30, 2022
+1 for fixing only in Wasm EH. Even if people can't ship with it yet on all browsers, for local debugging a developer can use a recent browser with Wasm EH.
[EH] Support stack traces for Wasm exceptions
[EH] Support stack traces for Wasm exceptions (#17979)