在Firebas或者Bugly等一些崩溃日志,亦或者有一些android机器log中的crash日志,往往以一种堆栈的形式展现。
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 000000706c74f3f0*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***Build fingerprint: 'google/redfin/redfin:11/RQ3A.211001.001/7641976:user/release-keys'Revision: 'MP1.0'pid: 32417, tid: 32500, name: UnityMain >>>
com.cyou.freestyle2.gp <<< x0 b40000706c74f2e0 x1 0000000000103000 x2 0000000000000001 x3 000000706c2a9578 x4 000000706c2a9530 x5 0000000000000004 x6 622f737465737361 x7 617461442f6e6962 x8 0000000000000000 x9 0000007061ef4000 x10 0000000000004000 x11 0000000000007ef4 x12 000000000014afd0 x13 a428000000fc0100 x14 0000000000008000 x15 0000000000000001 x16 0000007061e50818 x17 00000073760f6d68 x18 000000706c2a9514 x19 b40000706c74f2e0 x20 0000000000000000 x21 b400007254699eb0 x22 000000706c2ab000 x23 b400007254699f68 x24 00000070c8981af8 x25 000000706c2ab000 x26 000000000000000b x27 0000000000000001 x28 0000000000000000 x29 000000706c2a96b0 x30 0000007060fc3218 sp 000000706c2a9650 pc 0000007060fc7bd0 pstate 0000000060001000backtrace:
#00 pc 000000000033ccd8 /data/app/~~WVNFp6HzpKWuierMUyvmig==/com.cyou.freestyle2.gp-L9mKcI-dGqrOh7aLnki7Wg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libunity.so
#01 pc 0000000000361384 /data/app/~~WVNFp6HzpKWuierMUyvmig==/com.cyou.freestyle2.gp-L9mKcI-dGqrOh7aLnki7Wg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libunity.so #02 pc 0000000000004db4 /system/bin/app_process64 #03 pc 00000000000005c0 [vdso] (__kernel_rt_sigreturn) #04 pc 0000000000360bd0 /data/app/~~WVNFp6HzpKWuierMUyvmig==/com.cyou.freestyle2.gp-L9mKcI-dGqrOh7aLnki7Wg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libunity.so #05 pc 000000000035c218 /data/app/~~WVNFp6HzpKWuierMUyvmig==/com.cyou.freestyle2.gp-L9mKcI-dGqrOh7aLnki7Wg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libunity.so #06 pc 00000000000504f0 /data/app/~~WVNFp6HzpKWuierMUyvmig==/com.cyou.freestyle2.gp-L9mKcI-dGqrOh7aLnki7Wg==/oat/arm64/base.odex
查看这种堆栈的具体信息就需要用到符号表。
- NDK:E:\NDK\android-ndk-r13b-windows-x86_64\android-ndk-r13b\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\bin\aarch64-linux-android-addr2line.exe
- SO:"D:\Unity 2017.4.40\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Release\Symbols\arm64-v8a\libunity.sym.so"
- Address:000000000033ccd8 0000000000361384 ...
{NDK} -f -C -e {SO} {Address}
输出结果:
unwind_backtrace_signal_arch(siginfo*, void*, map_info const*, backtrace_frame_t*, unsigned long, unsigned long)
??:?
NativeRuntimeException::signal_handler(int, siginfo*, void*)
??:?
??
??:0
??
??:0
NativeRuntimeException::CatchAndRethrow()
??:?
nativeDone(_JNIEnv*, _jobject*)
??:?
??
??:0
就能查看一些具体信息,但是也只能到c++层。 有一点用,但是用处不大,很难定位到具体的unity代码和行数。