Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Unable to get ndk-stack tool to work with Unity stacktrace

Discussion in 'Android' started by ajon542, Sep 5, 2019.

  1. ajon542

    ajon542

    Joined:
    Oct 22, 2013
    Posts:
    25
    Hi,
    I'm investigating a crash on Android and using ndk-stack to symbolize the stack trace. I have the logcat output of the stack trace as well as the symbols.zip that gets created during the Unity build. I have unzipped symbols.zip and located the symbols for arm64-v8a. When I run the ndk-stack command, it doesn't really give me any more information.

    Unity 2018.4.2f1 Il2cpp Arm64 with "strip engine code" enabled.


    ndk-stack -sym builds/symbols/arm64-v8a -dump crash.txt

    ********** Crash dump: **********
    pid: 28596, tid: 28677, name: UnityMain >>> com.company.app <<<
    Stack frame #00 pc 00000000000004fc [vdso] ()
    Stack frame #01 pc 00000000005838f0 /data/app/com.company.app-1/lib/arm64/libunity.so ()
    Stack frame #02 pc 0000000001ac4334 /data/app/com.company.app-1/lib/arm64/libil2cpp.so ()
    Stack frame #03 pc 0000000001a2c134 /data/app/com.company.app-1/lib/arm64/libil2cpp.so ()
    Stack frame #04 pc 00000000020ad670 /data/app/com.company.app-1/lib/arm64/libil2cpp.so ()


    Additionally, I attempted to use the addr2line tool with no further success.
    https://support.unity3d.com/hc/en-us/articles/115000292166-Symbolicate-Android-crash

    Is there anything that I could be missing or doing wrong? Has anyone else had success with the ndk-stack tool and Unity stack traces?
     
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,165
    What are the commands you are issuing, and what is the full output?
    What is the Unity version?
    (guess: are you using addr2line that is 64bit and matches the NDK version)
     
  3. ajon542

    ajon542

    Joined:
    Oct 22, 2013
    Posts:
    25
    I'm using Unity 2018.4.2f1.

    The command I issued for ndk-stack is mentioned above along with the output. It's not giving any file/function names.

    After some more experimentation with the different addr2line tools listed below, the one that I was using i.e. "arm-linux-androideabi-addr2line" was not working. Though, I'd need to do a bit more research into them to find the correct one to use. All the others seem to produce some more meaningful output.
    • i686-linux-android-addr2line
    • mips64el-linux-android-addr2line
    • x86_64-linux-android-addr2line
    • arm-linux-androideabi-addr2line
    • mipsel-linux-android-addr2line
    • aarch64-linux-android-addr2line
    Working:

    x86_64-linux-android-addr2line -f -C -e arm64-v8a/libunity.sym.so 00000000005838f0
    UnloadAssetBundle(AssetBundle&, bool, bool)
    ??:?

    Not working:

    arm-linux-androideabi-addr2line -f -C -e arm64-v8a/libunity.sym.so 00000000005838f0
    arm-linux-androideabi-addr2line: arm64-v8a/libunity.sym.so: File format not recognized
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,165
    aarch64-linux-android-addr2line should be the one to be used with 64-bit apps.
     
    Last edited: Sep 13, 2019
    ajon542 likes this.
  5. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    12
    @ajon542 We also experience the same results as you. When we try to symbolicate our crash addresses using aarch64-linux-android-addr2line we get nothing legible, but using x86_64-linux-android-addr2line in the toolchains->x86_64_4.9->prebuilt->darwin-x86_64->bin works (Apparently)

    We build .aab files using Unity version 2021.3.9f, with debugging symbols selected in build options. I would very much like to know why x86_64-linux-android-addr2line works, as I need to know I can trust the results.
     
  6. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    349
  7. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    12
    @Alan-Liu Yes I tried the Stacktrace utility, it doesn't resolve anything, it used to work last year, but now it doesn't, and now the x86_64-linux-android-addr2line does work. Not needed to use it since upgrading Unity to 2021.3.9f1, perhaps this is an internal change within Unity? I would need a solid idea of why this is happening before I trust the output.