I’me getting random and hard to reproduce crashes on Android, with a quite simple game I writting.
Using cocos2d-x 2.1.1
From logcat I know that it is caused by a segmentation fault (SIGSEGV), but the stack trace shows a single stack frame; something like:
I/DEBUG ( 31): #00 pc 0035c520 ..xxx/libgame.so
I/DEBUG ( 31): #01 lt 00000000
There is no “#02” entry, just #00 and #01, which seems odd to me.
ndk-stack didn’t help:
“Unable to locate routine information for address 35c520 in module libgame.so”
So I tried using addr2line:
arm-linux-androideabi-addr2line -f -e obj/local/armeabi/libgame.so 35c520
and I get:
I also generated a map file, to double check the above. Address 35c520 falls inside __dynamic_cast.
I use dynamic_cast a few times in my code, to get objects from a CCArray, which I’m absolutetly sure they are CCSprite.
When crashing, sometimes dynamic_cast returns NULL, but some others return some address.
Anyway, it should not return NULL,…
I’ve read in the forum that some time ago people were getting SIGSEGV when using dynamic casting on Android, which was solved by linking against gnustl_static.
I’m using gnustl_static, as it is by default in cocos2d-x 2.1.1.
Any ideas of how can I proceeed?