WebGL builds: decipher jsStackTrace errors with symbol map?

A lot of my players are getting the same error. We collect the JavaScript logs and it shows up as “abort(153) at jsStackTrace” but the since the stack trace is minified, I can’t really get any information about where in the code something goes wrong from it.

I’ve had a look at this talk from Unite Europe 2016, where a dev explains that you can create a symbol map that can be used to decipher the stack trace. (Link goes exactly to the part where he talks about it)

He talks about having to pass an argument in order for the symbol map to be emitted, but according to this answers post, Unity 5.4 and upwards takes care of that internally.

So here comes the part that I’m struggling with:

What exactly is a symbol map and how do I use it to read the jsStackTrace error?

Unfortunately, the talk I linked to just says that you can use the map to decipher the StackTrace, but doesn’t mention how, and I’ve been unable to find anything else on the subject.

As far as I know, I could build with Full Exception Support in order to get readable logs, but that would drastically increase file size and have an impact on performance, which is why I’d prefer to find another solution.

A symbol map is a just a text file containing a list of symbols and their corresponding mangled function names from native code and scripts. Something like:

Vb:_glClearStencil
hVe:_Array_InternalArray__ICollection_Add_TisMark_t2724874473_m1613484179_gshared
zLf:_mbrlen
ZZd:_RuntimeTypeHandle_GetObjectData_m3567098501
...

In Unity 5.3 (or earlier version), this is not generated by default. You need to set this property to do so:

PlayerSettings.SetPropertyString("emscriptenArgs", "--emit-symbol-map");

The symbol map is then generated in your project_folder\Temp\StagingArea\Data folder, which can be used to lookup each symbol in your callstack, either manually or ideally with a script that reads both callstack and symbol map and produces an “almost” readable callstack (function names will still be mangled but it’s usually good enough).

The idea is that, for each content you publish, you keep the corresponding symbol map so that when you get a crash report from a user you can derive the unminified callstack.
This can all be automated so that when a crash happens, the callstack is sent to your server that will process it and send you a bug report. This way you don’t need to do anything else, but this is something you would need to setup.

  1. In 5.4+, the symbol map is generated
    by default.
  2. In 5.5+ this is all much
    easier: there is a new
    WebGL-specific option to
    generate the symbol map as .debugSymbols.jsgz file in
    your the Release folder, which will
    be hosted with the other build files
    (.jsgz, .datagz, etc…). Then, upon
    crash the symbol map will be
    automatically downloaded to lookup
    the callstack function names for you
    and the user will be shows a
    readable and unmangled callstack!