Search Unity

Debug symbols, and logs from WASM?

Discussion in 'Web' started by CarlDev, Jul 16, 2018.

  1. CarlDev

    CarlDev

    Joined:
    Dec 9, 2016
    Posts:
    15
    Greetings,

    I'm trying to get clear stack traces from our webGL/WASM client. We need those in both debug and release builds.
    I have not been able to find any documentation on how to use the debug symbols.

    WebGLBuild.wasm.symbols.unityweb is output with the client if I build with debug symbols. As far as I've understood those are supposed to be used automatically by the client.
    It does not give me readable logs in the browser, though.

    How is this supposed to work? How do I use this feature?

    I've also looked at:
    Temp\StagingArea\Data\linkresult_wasm\build.js.symbols
    and
    Temp\StagingArea\Data\il2cppOutput\Symbols\MethodMap.tsv

    Those could be used to translate the browser log into a human readable call stack.
    Is this a better way to go?

    - Carl, KoGaMa/Multiverse
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Hi Carl,
    if the Debug Symbols options is enabled, the UnityLoader will download the symbols file and demangle the callstack which is then printed in the console. To see how it's done you can check the un-minified UnilyLoader.js code in the Unity installation folder.

    Does that help?
     
  3. CarlDev

    CarlDev

    Joined:
    Dec 9, 2016
    Posts:
    15
    Thanks.
    It does help a lot in terms of deciding where to focus my investigation.

    My logs still look like:
    Some message
    at wasm-function[22395]:95
    ...

    I will look into the loader as suggested.
     
  4. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    which browser and version?
     
  5. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Anything but Firefox 54.0.1 is useless for me wrt wasm debugging. A must have for Unity webgl. :p
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    I think this is because there was a change in the Wasm names section format:
    • From Unity 5.6 to 2018.1, you should use Firefox 54 or older.
    • As of Unity 2018.2, you should use Firefox 55 or newer.
     
    kognito1 likes this.
  7. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    I can confirm with great sadness that my trusty 54.0.1 Firefox installation is now useless with Unity 2018.2. The latest version of Firefox (61.0.1) seems to work with 2018.2 and debug symbols in wasm!
     
  8. CarlDev

    CarlDev

    Joined:
    Dec 9, 2016
    Posts:
    15
    Setup:
    Unity 2018.2.
    Logging set to full.
    Exception support set to full with stack trace.
    Debug symbols generated.

    Result:
    Stack traces from logs are not translated. They still refer to numbered wasm functions.
    Exceptions are translated properly. As far as I know, this isn't dependent on the debug symbols, though.

    Test results are consistent between Firefox 61.0.1 and Chrome 67.0.3396.99.


    Considering what you've said I will go with the assumption that this is a project specific issue.
    I'll try to update the thread if I find the problem/solution.
     
  9. willardjuice

    willardjuice

    Joined:
    Oct 9, 2016
    Posts:
    1
    Have you tried a "development build" with full logging?
     
  10. CarlDev

    CarlDev

    Joined:
    Dec 9, 2016
    Posts:
    15
    Development builds does indeed translate the the logs.
    This without outputting any debug symbols, even though debug symbols are checked.

    Development builds also have other side effects, which are highly undesirable for live releases. Not a viable solution for our case.
     
  11. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    We make two binaries of every "build" we release. One "normal binary" (no exceptions, no symbols, limited logging) and one "debug binary" (development build, full exceptions, symbols, full logging). We obviously serve the normal binary to our users and if there's ever an error/exception we then load up the debug binary and attempt to reproduce the error. Works out in practice for us.
     
  12. ChristianKoGaMa

    ChristianKoGaMa

    Joined:
    Jul 11, 2017
    Posts:
    18
    Hi,
    So just wondering: Is it possible to do a non dev wasm build and get reasonable stack traces from for instance Chrome or Firefox in this point in time?
     
  13. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    247
    I would love to know this as well.
     
  14. claytoncurmi

    claytoncurmi

    Joined:
    Jul 6, 2010
    Posts:
    168
    Bump
     
  15. claytoncurmi

    claytoncurmi

    Joined:
    Jul 6, 2010
    Posts:
    168
    I am experiencing the same issue as described here... I posted a detailed explanation here - https://forum.unity.com/threads/get-symbol-maps-to-work.979944/. Would you be so kind to help sort this out please?
     
  16. mitchmeyer1

    mitchmeyer1

    Joined:
    Sep 19, 2016
    Posts:
    32
    Hello @Marco-Trivellato
    In your response

    "Hi Carl,
    if the Debug Symbols options is enabled, the UnityLoader will download the symbols file and demangle the callstack which is then printed in the console. To see how it's done you can check the un-minified UnilyLoader.js code in the Unity installation folder.

    Does that help?"

    That cleared some stuff up for my silimar problem. But do we need to "create" or upload the debug symbols anywhere? How are they created? I cannot find it anywhere in the documentation
     
  17. claytoncurmi

    claytoncurmi

    Joined:
    Jul 6, 2010
    Posts:
    168
    Enable the 'Debug Symbols' in the player settings for WebGL. This creates a debug symbols file which is just a key value file. I created a simple lookup code using PHP to convert the key into the method name. Check this post for some more details - https://forum.unity.com/threads/get-symbol-maps-to-work.979944/