cocos2dx-3.17使用ndkr23c编译成so文件,打开asan之后会在jni_onload的函数内闪退。
崩溃发生在cocos_android_app_init(JniHelper::getEnv());这一行,经过实验,JNI_OnLoad传进来的vm就是一个无效的指针,只要使用vm就会崩溃。下面是asan捕获到的堆栈
I ==13277==ERROR: AddressSanitizer: SEGV on unknown address 0x1680001f73174270 (pc 0x007a9e4c37b4 bp 0x007fdac13550 sp 0x007fdac134c0 T0)
==13277==The signal is caused by a READ memory access.
#0 0x7a9e4c37b4 (/data/app/~~QsGJ9aun9nbbnDth6ya0Qw==/com.example.asantest-kRvQWKCIljKk9Lbx0PHndA==/lib/arm64/libcocos2dlua.so+0x12be7b4)
#1 0x7a9e4b82f4 (/data/app/~~QsGJ9aun9nbbnDth6ya0Qw==/com.example.asantest-kRvQWKCIljKk9Lbx0PHndA==/lib/arm64/libcocos2dlua.so+0x12b32f4)
#2 0x7b12581b10 (/apex/com.android.art/lib64/libart.so+0x36db10)
#3 0x7b081b4130 (/apex/com.android.art/lib64/libopenjdkjvm.so+0x5130)
AddressSanitizer can not provide additional info.