How to check crash log using android ndk in cocos2d-x
Asked Answered
M

1

13

I use cocos2d-x to develop a game, after it runs perfectly in iOs, I turn around to android platform.

But it run somewhere in android, and I only receive some error log like this:

08-26 10:49:23.823: A/libc(2884): Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 2917 (Thread-285)

With this, I can't fix the crash log.

So my question is how can I check the stack of crash log?

And in SO, there are some similar questions, but with none useful answer to me.

Using ndk-stack to read crash logs

Unable to get line no from stack trace in android ndk

How to get Useful crashlog information Android Cocos2dx C++

Monsoon answered 26/8, 2013 at 3:57 Comment(1)
going through same error ... my cocos2d-x code runs so fine ... but same code gives this errorWaftage
M
29

I find the perfect answer in http://www.cocos2d-x.org/boards/6/topics/20437.

The solution is:

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


And I try it, and get the following stack-trace:

********** Crash dump: **********
Build fingerprint: 'google/soju/crespo:4.1.2/JZO54K/485486:user/release-keys'
pid: 2884, tid: 2917, name: Thread-285  >>> com.gumichina.allen <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000c
Stack frame #00  pc 0062bfb4  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+20): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:82
Stack frame #01  pc 006d8094  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchHandler::~CCTouchHandler()+128): Routine ~CCTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:108
Stack frame #02  pc 006d8524  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+84): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193
Stack frame #03  pc 006d8570  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+20): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193
Stack frame #04  pc 0062bff4  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+84): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:86
Stack frame #05  pc 006aade4  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObjectAtIndex(cocos2d::_ccArray*, unsigned int, bool)+100): Routine ccArrayRemoveObjectAtIndex in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:197
Stack frame #06  pc 006aafa0  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObject(cocos2d::_ccArray*, cocos2d::CCObject*, bool)+72): Routine ccArrayRemoveObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:235
Stack frame #07  pc 0062fed4  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCArray::removeObject(cocos2d::CCObject*, bool)+52): Routine removeObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCArray.cpp:295
Stack frame #08  pc 006d6c90  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::forceRemoveDelegate(cocos2d::CCTouchDelegate*)+500): Routine forceRemoveDelegate in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:200
Stack frame #09  pc 006d7888  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int)+1620): Routine touches in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:449
Stack frame #10  pc 006d7b74  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)+56): Routine touchesEnded in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:507
Stack frame #11  pc 0068acb8  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCEGLViewProtocol::handleTouchesEnd(int, int*, float*, float*)+124): Routine handleTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/CCEGLViewProtocol.cpp:333
Stack frame #12  pc 0069340c  /mnt/asec/com.gumichina.allen-2/lib/liballen.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd+88): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/android/jni/TouchesJni.cpp:42
Stack frame #13  pc 0001de30  /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #14  pc 0004ce73  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+390)
Stack frame #15  pc 0004ef8f  /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+174)
Stack frame #16  pc 00027260  /system/lib/libdvm.so
Stack frame #17  pc 0002bb38  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #18  pc 0005f5b1  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
Stack frame #19  pc 0005f5db  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #20  pc 00054193  /system/lib/libdvm.so
Stack frame #21  pc 00012b90  /system/lib/libc.so (__thread_entry+48): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor
Stack frame #22  pc 000122f4  /system/lib/libc.so (pthread_create+172): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor
Monsoon answered 26/8, 2013 at 3:57 Comment(6)
Srinivass-MacBook-PRO:proj.android SrinivasJ$ cd /Users/SrinivasJ/android-ndk-r9 Srinivass-MacBook-PRO:android-ndk-r9 SrinivasJ$ adb logcat | ./ndk-stack -sym $PROJECT_PATH/obj/local/armeabi -bash: adb: command not found i try to check as u said.... but adb coomand not found error getting... is i nee dto load NDK or SDKMccrea
I also tried this solution, but adb is not found on this direcotoryKerrin
@FilipeFerminiano @Mccrea you should add the Android sdk path where adb is to your system PATH. For me, it is in $ANDROID_SDK/platform-toolsMonsoon
@Monsoon Thanks for the help, it was usefull. But I don't understand the command. Could you please explain what we pass through pipe from adb logcat to ndk-stack?Flea
Hi, I got " '.' is not recognized as an internal or external command" on windows. How to fix it?Valerlan
@Vinh.TV, To fix the error "'.' is not recognized as an internal or external command", just replace the ./ndk-stack with full path of ndk-stack. in my system its in C:\Users\$USERNAME\AppData\Local\Android\Sdk\ndk-bundle\ndk-stackBria

© 2022 - 2024 — McMap. All rights reserved.