I am looking to get a stack trace on crashes for minified RELEASE builds in WebGL, and believe we can do this using the standard Emscripten output, as we have done it on another project that uses Emscripten. I know that you can get a readable stack trace on DEBUG builds because of the following:
When you tick the “Development Build” checkbox, Unity will generate a development build (with Profiler support and the development console for errors, like on other platforms). Additionally, Development builds are non-minified, so the generated JavaScript is human-readable and preserves function names (so you will get useful stack traces for errors), but very large to distribute.
What we need is a specific symbol to be added to the build args for emscripten, --emit-symbol-map, so that the file is outputted in the build. From the emscripten docs:
–emit-symbol-map: Save a map file between the minified global names and the original function names. This allows you, for example, to reconstruct meaningful stack traces.
https://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html
That is the file we get on our other project where we can see the symbols map.
Unity seems to have its own method of passing arguments to emscripten. For example, when you select the “Optimizations Level” in the WebGL settings, it modifies an entry to the projectsettings.asset. At compile time, that entry is mapped to the optimization argument passed into emscripten, for example, “Fast Builds” in Unity maps to -O0: no optimizations. One of the others maps to -O2: various JavaScript-level optimizations and LLVM -03 optimizations.
The problem is, as far as I know, there isn’t a place where we can inject custom args into the emscripten execution. We need this argument to be passed to emscripten, and the resulting .symbols file to end up in the build output folder. Then we can read the Javascript stack trace, hand-map it to the cpp stack trace, and finally to our C# code, which will be very useful for crash debugging.
Can this be done in Unity as is?
Is it possible to have unity tell emscipten to compile for WebAssembly as in this post: [https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/][1] emcc file.cpp -o file.js -s ‘BINARYEN=”path-to-binaryen”’ [1]: https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
– GaudonMarked as obsolete in 2017.4, how do we do this now?
– monark