I’m getting random crashes in the middle of the game, and I mean
random
, meaning sometimes it happens, sometimes it doesn’t. It also happens at random points in the game. I think it’s memory related.
This is what Eclipse LogCat shows me. I can’t figure out what it means though.
It also sometimes gives me one of the best error messages there is: “debugger committed suicide to free the zombies!”
I’m using cocos2d-x 2.0.4, Eclipse Juno, and Kindle Fire for testing.
Anyone else experiencing this?
I made a bit of a progress and I want to share what I did.
When you get errors like this on the LogCat, they are saved on $PROJECT_PATH/obj/local/armeabi where $PROJECT_PATH is the path to your cocos2d-x android project. To symbolicate the messages to something understandable, you can use the ndk-stack tool.
Open up the Terminal (or Cygwin, not sure though) and type in
cd $ANDROID_NDK
adb logcat | ./ndk-stack -sym $PROJECT_PATH/obj/local/armeabi
where: $ANDROID_NDK is the path to your android NDK PROJECT_PATH is the path to your cocos2d-x android project
After that, you will get a stack trace which points to certain files and line number where the crash occurred. Something like this:
********** Crash dump: **********
Build fingerprint: 'generic/blaze/blaze:2.3.4/GINGERBREAD/6.3.1_user_4107920:user/release-keys'
pid: 16346, tid: 16354 >>> com.mycompany.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 002a13f0 /data/data/com.mycompany.myapp/lib/libmyapp.so: Unable to locate routine information for address 2a13f0 in module
Stack frame #01 pc 0012e81e /data/data/com.mycompany.myapp/lib/libmyapp.so: Routine updateNode in jni/../../Classes/TowerObj.cpp:150
Stack frame #02 pc 000f3648 /data/data/com.mycompany.myapp/lib/libmyapp.so: Routine updateLayer in jni/../../Classes/BuilderLayer.cpp:107
Stack frame #03 pc 0010bb94 /data/data/com.mycompany.myapp/lib/libmyapp.so: Routine updateGame in jni/../../Classes/MainGameLayer.cpp:172
( more here pointing to cocos2d-x classes )
From the dump above, you can see that on Stack frame #01 points to TowerObj.cpp:150, so I can now go to TowerObj.cpp at line 150 and fix stuff.
Hope this helps.
Additional information
If your Application.mk define that “armeabi”, that link is correct.
$PROJECT_PATH/obj/local/armeabi
But if you define that armeabi-v7s , the correct one is
$PROJECT_PATH/obj/local/armeabi-v7s
Thank you very much, and I also have a question (about logcat out “I/DEBUG”), I use the adb logcat > d: \ log.txt ,after opening It ,it shows like this 60bc66229097a475.png773×472
, how can I be my android application to print out a similar "I/DEBUG log information?
I am facing a similar problem. My code is running for iOS, but not for android.
Here is the crash dump:
********** Crash dump: ************
Build fingerprint: ‘motorola/condor_retaildsds/condor_umtsds:4.4.4/KXC21.5-40/46:user/release-keys’
pid: 15363, tid: 15388, name: Thread-32990 >>> com.frogcoders.smack.moles <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0b04f856
Stack frame #00 pc 0b04f856
Stack frame #01 pc 004a9ef7 /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (cocos2d::ProtectedNode::cleanup()+34): Routine cocos2d::ProtectedNode::cleanup() at ??:?
Stack frame #02 pc 0049a04b /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (cocos2d::Node::detachChild(cocos2d::Node*, int, bool)+66): Routine cocos2d::Node::detachChild(cocos2d::Node*, int, bool) at ??:?
Stack frame #03 pc 0049a11f /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (cocos2d::Node::removeChild(cocos2d::Node*, bool)+150): Routine cocos2d::Node::removeChild(cocos2d::Node*, bool) at ??:?
Stack frame #04 pc 004980a3 /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (cocos2d::Node::removeFromParentAndCleanup(bool)+24): Routine cocos2d::Node::removeFromParentAndCleanup(bool) at ??:?
Stack frame #05 pc 00498087 /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (cocos2d::Node::removeFromParent()+10): Routine cocos2d::Node::removeFromParent() at ??:?
Stack frame #06 pc 00387bac /mnt/asec/com.frogcoders.smack.moles-1/lib/libcocos2dcpp.so (GameScreen::init()+2280): Routine GameScreen::init() at /Users/admin/Desktop/Cocos2dx/GamePrograming/SmackMoles/SmackMoles/proj.android/jni/…/…/Classes/GameScene.cpp:83