unity3D技术分享

UnityIL2CPP包Crash闪退利用Android Log

2023-07-29  本文已影响0人  好怕怕
image.png

一、安装Android Logcat插件


1、新建空白unity工程,打开PackageManager窗口,菜单栏Window/PackageManager

image.png

2、PackageManager中安装Android Logcat日志工具

image.png

3、安装AndroidLogcat完成

image.png

二、测试

1、编写测试代码

using System.Collections;
using UnityEngine;

// crash测试脚本
public class CrashTest : MonoBehaviour
{
    void Start()
    {
        StartCoroutine(OnTest());
    }

    private IEnumerator OnTest()
    {
        Debug.LogError("3秒开始");
        yield return new WaitForSeconds(3);
        Debug.LogError("3秒结束");
        int index = 1;
        while (true)
        {
            long[] size = new long[10000 * 200000];
            Debug.LogError("数组次数:" + index);
            index++;
            yield return new WaitForSeconds(1);
        }
    }

}

2、新建空白场景scene,进入场景新建一个空的GameObject,挂载上面的脚本

image.png

3、编译器启动游戏测试一下,通过下面的日志,我们可以看到内存溢出

image.png

三、出包测试

1、我们知道这个包必然crash,只是想要分析出IL2CPP后crash的信息,所以我们自己写的代码需要用到出包时的符号表,在出包时勾选Create symbols.zip选项,在PlayerSettings面板中,出包选项从mono切换到il2cpp,然后Build包

image.png
image.png

2、出包完成,目录会有一个apk和一个zip的符号表压缩包

image.png

3、安装到手机或者模拟器,我这里使用的是mumu模拟器12(其它模拟器都可以),启动游戏等待3s后,发现闪退了;

GIF.gif

四、Crash查看

1、菜单栏打开AndroidLogcat工具,Window/Analysis/AndroidLogcat

image.png

2、连接手机或者模拟器(手机插上去开启USB调试,就会自动连接)点击No device,点击Other connection options...

image.png

IP输入127.0.0.1,Port端口具体根据模拟器来(百度查),mumu模拟器的端口是7555,然后点击左下角的按钮Connect开始连接

image.png

连接完成后,点击ok关闭

image.png

这个时候工具已经连接到了模拟器,可以看到日志输出了

image.png

3、启动游戏,查看crash日志,无用log先过滤一下,点击Tag,然后选择CRASH选项

image.png

carsh日志

2023/07/29 10:46:06.883 3097 3121 Error Unity 3秒开始
2023/07/29 10:46:06.883 3097 3121 Error Unity UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
2023/07/29 10:46:06.883 3097 3121 Error Unity UnityEngine.Logger:Log(LogType, Object)
2023/07/29 10:46:06.883 3097 3121 Error Unity UnityEngine.Debug:LogError(Object)
2023/07/29 10:46:06.883 3097 3121 Error Unity <OnTest>d__1:MoveNext()
2023/07/29 10:46:06.883 3097 3121 Error Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2023/07/29 10:46:06.883 3097 3121 Error Unity UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
2023/07/29 10:46:06.883 3097 3121 Error Unity CrashTest:Start()
2023/07/29 10:46:06.883 3097 3121 Error Unity  
2023/07/29 10:46:06.883 3097 3121 Error Unity (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
2023/07/29 10:46:06.883 3097 3121 Error Unity 
2023/07/29 10:46:09.884 3097 3121 Error Unity 3秒结束
2023/07/29 10:46:09.884 3097 3121 Error Unity UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
2023/07/29 10:46:09.884 3097 3121 Error Unity UnityEngine.Logger:Log(LogType, Object)
2023/07/29 10:46:09.884 3097 3121 Error Unity UnityEngine.Debug:LogError(Object)
2023/07/29 10:46:09.884 3097 3121 Error Unity <OnTest>d__1:MoveNext()
2023/07/29 10:46:09.884 3097 3121 Error Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
2023/07/29 10:46:09.884 3097 3121 Error Unity  
2023/07/29 10:46:09.884 3097 3121 Error Unity (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
2023/07/29 10:46:09.884 3097 3121 Error Unity 
2023/07/29 10:46:09.885 3097 3121 Error CRASH *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023/07/29 10:46:09.885 3097 3121 Error CRASH Version '2019.4.35f1 (0462406dff2e)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'x86'
2023/07/29 10:46:09.885 3097 3121 Error CRASH Build fingerprint: 'OnePlus/OnePlus8Pro/OnePlus8Pro:12/V417IR/2307191948:user/release-keys'
2023/07/29 10:46:09.885 3097 3121 Error CRASH Revision: '0'
2023/07/29 10:46:09.885 3097 3121 Error CRASH ABI: 'x86'
2023/07/29 10:46:09.885 3097 3121 Error CRASH Timestamp: 2023-07-29 10:46:09+0800
2023/07/29 10:46:09.885 3097 3121 Error CRASH pid: 3097, tid: 3121, name: UnityMain  >>> com.quadtree.cn <<<
2023/07/29 10:46:09.885 3097 3121 Error CRASH uid: 10034
2023/07/29 10:46:09.885 3097 3121 Error CRASH signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2023/07/29 10:46:09.885 3097 3121 Error CRASH Cause: null pointer dereference
2023/07/29 10:46:09.885 3097 3121 Error CRASH     eax 00000000  ebx c9ec7ff4  ecx 0000003e  edx 00000004
2023/07/29 10:46:09.885 3097 3121 Error CRASH     edi b9aca000  esi c63ce570
2023/07/29 10:46:09.885 3097 3121 Error CRASH     ebp cd47d6c8  esp cd47d690  eip c95e5c57
2023/07/29 10:46:09.885 3097 3121 Error CRASH backtrace:
2023/07/29 10:46:09.885 3097 3121 Error CRASH       #00 pc 00103c57  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.885 3097 3121 Error CRASH       #01 pc 0017283a  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.885 3097 3121 Error CRASH       #02 pc 006d37c0  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.885 3097 3121 Error CRASH       #03 pc 003b73b2  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #04 pc 001cd9db  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #05 pc 00117309  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #06 pc 000df0c8  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libil2cpp.so (il2cpp_runtime_invoke+57) (BuildId: 1b768c9e702a98b4b82b5239c86e5513ee2d3043)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #07 pc 002472af  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #08 pc 00256b0e  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #09 pc 0025f470  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #10 pc 0025f017  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #11 pc 0025efdc  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #12 pc 0011fbf9  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #13 pc 001bc685  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #14 pc 001b7acd  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #15 pc 001b7b07  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #16 pc 001b7d90  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #17 pc 002cd3ab  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #18 pc 002e2f5b  /data/app/~~7VfoWRD0toRa2gYq57JvJA==/com.quadtree.cn-RbVmkrNZdVzi8mkVJWfJSg==/lib/x86/libunity.so (BuildId: 60862b06573cfc2f6310356b7a54748bafd3477c)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #19 pc 00165ef2  /apex/com.android.art/lib/libart.so (art_quick_test_suspend+98) (BuildId: 7504b6c302e0da4de438481c84ffb078)
2023/07/29 10:46:09.886 3097 3121 Error CRASH       #20 pc 00090a0f  [anon:scudo:primary]

从上来面的crash日志看不出来应用包为什么闪退了

5、Crash日志解析

1、开始配置符号表

解压出包时导出的符号表zip包crashTest01-1.0.0-v1.symbols.zip

右上角,点击Tools,点击Stacktrace Utility

image.png

点击Configure Symbol Path,然后弹出的配置界面点击+号,

image.png

点击Pick Custom Location,选择刚刚解压的符号表文件夹

image.png

image.png

配置完成后关闭配置界面,选中我们的crash日志,单击右键复制

image.png

点击Stacktrace Utility,打开解析窗口,粘贴日志到Original的输入框中,点击右上角的按钮Resolve Stacktraces进行分析

image.png

分析结果

image.png

闪退信息,从绿色的信息,前三句我们就可以分析出crash的原因了

(il2cpp::vm::Object::AllocatePtrFree(unsigned int, Il2CppClass*) at D:\Program Files\Unity 2019.4.35f1\Editor\Data\il2cpp\libil2cpp\vm/Object.cpp:67)

第1句,在分配空闲内存的日志


(SZArrayNew(Il2CppClass*, unsigned int) at D:\Program Files\Unity 2019.4.35f1\Editor\Data\il2cpp\libil2cpp\codegen/il2cpp-codegen-il2cpp.cpp:103)

第2句,数组在new的时候的日志


(U3COnTestU3Ed__1_MoveNext_mB18693257AF063A8F1C1F445D853D012FDAD7FF6 at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6142)

第3句,OnTest函数在MoveNext的时候的日志,可以看到U3COnTestU3Ed__1_MoveNext所在的程序集Assembly-CSharp.cpp,那就确定是我们的代码问题导致的crash了


六、分析结束

1、在OnTest的协程函数中,new了一个数组导致了crash,我们可以计算出这个数组的内存大小

long占用8个字节,10000 x 200000 x 8 / 1024 / 1024~=15258m / 1024 ~= 15g内存

image.png

2、测试2,递归调用

测试代码

using UnityEngine;

// crash测试脚本
public class CrashTest : MonoBehaviour
{
    void Start()
    {
        onTestGameObjectNull(null);
    }

    public void onTestGameObjectNull(GameObject go)
    {
        onTestGameObjectNull(null);
    }
}

闪退日志

2023/07/30 09:18:10.248 3563 3582 Error CRASH       #00 pc 006e721b  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #01 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #02 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #03 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #04 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #05 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #06 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #07 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #08 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #09 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #10 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #11 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #12 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #13 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #14 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #15 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #16 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #17 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #18 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #19 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #20 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #21 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #22 pc 006e725a  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)

符号表解析报错的日志

2023/07/30 09:18:10.248 3563 3582 Error CRASH       #00 pc 006e721b (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6325)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #01 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #02 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #03 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #04 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #05 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #06 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #07 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #08 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #09 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #10 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #11 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #12 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #13 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #14 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #15 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #16 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #17 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #18 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #19 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #20 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #21 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)
2023/07/30 09:18:10.248 3563 3582 Error CRASH       #22 pc 006e725a (CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6334)  /data/app/~~ZEgiyDs3DM-7FhvsL_aDvQ==/com.quadtree.cn-BLIdfQxEpZklc7Xd06X6ww==/lib/x86/libil2cpp.so (BuildId: 508fe06972a6dbbf66f04c36a1e6387319af4f35)

我们发现每一行的解析内容都一样

(CrashTest_onTestGameObjectNull_m33EE6C7FEB8E639503AF57D772775F5429DC03CB at E:\unity_demo\QuadTreeDemo\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp.cpp:6325)

上面的内容已经得出了,我们有一个类CrashTest,里面的函数是onTestGameObjectNull,一直在自己调用自己导致的crash


7、补充

1、我们自己写的代码导致的crash,符号表是:libil2cpp.so,分析我们的代码crash时,出包时需要导出符号表

image.png

2、unity代码导致的crash,符号表是:libunity.so

image.png

3、Android Logcat默认已经根据当前安装的功能,配置了libunity.so

image.png

4、也可以使用ndk addr2line.exe来解析崩溃的内存地址到c++函数名,但是AndroidLogcat插件更胜一筹


禁止转载

上一篇下一篇

猜你喜欢

热点阅读