Using NDK-STACK to Debug Cocos2dx Android Project
来源:互联网 发布:篮球战术板软件 编辑:程序博客网 时间:2024/06/04 17:52
‘ndk-stack’ is a simple tool that allows you to analyze stack traces as they appear in the output of ‘adb logcat’ and replace any address inside a shared library with the corresponding:values.
In the output of ‘adb logcat’, you may see something like the followings, and we must translate those:
I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG ( 31): Build fingerprint: 'generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys'I/DEBUG ( 31): pid: 351, tid: 351 %gt;%gt;%gt; /data/local/ndk-tests/crasherI/DEBUG ( 31): signal 11 (SIGSEGV), fault addr 0d9f00d8I/DEBUG ( 31): r0 0000af88 r1 0000a008 r2 baadf00d r3 0d9f00d8I/DEBUG ( 31): r4 00000004 r5 0000a008 r6 0000af88 r7 00013c44I/DEBUG ( 31): r8 00000000 r9 00000000 10 00000000 fp 00000000I/DEBUG ( 31): ip 0000959c sp be956cc8 lr 00008403 pc 0000841e cpsr 60000030I/DEBUG ( 31): #00 pc 0000841e /data/local/ndk-tests/crasherI/DEBUG ( 31): #01 pc 000083fe /data/local/ndk-tests/crasherI/DEBUG ( 31): #02 pc 000083f6 /data/local/ndk-tests/crasherI/DEBUG ( 31): #03 pc 000191ac /system/lib/libc.soI/DEBUG ( 31): #04 pc 000083ea /data/local/ndk-tests/crasherI/DEBUG ( 31): #05 pc 00008458 /data/local/ndk-tests/crasherI/DEBUG ( 31): #06 pc 0000d362 /system/lib/libc.soI/DEBUG ( 31):
How to use this tool
If you succeed in building Cocos2d-x android project, it will generate shared libraries in $PROJECT_PATH/obj/local/abi, where ‘abi’ stands for your device’s ABI (i.e.’armeabi’ by default);
You can feed the logcat text either as direct input to the program, e.g.:
adb logcat | $NDK/ndk-stack -sym $PROJECT_PATH/obj/local/armeabi
Or you can use the -dump option to specify the logcat as an input file, e.g.:
adb logcat > /tmp/foo.txt$NDK/ndk-stack -sym $PROJECT_PATH/obj/local/armeabi -dump foo.txt
After that, you will get the more readable output:
********** Crash dump: **********Build fingerprint: 'generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys'pid: 351, tid: 351 /data/local/ndk-tests/crasher signal 11 (SIGSEGV), fault addr 0d9f00d8Stack frame #00 pc 0000841e /data/local/ndk-tests/crasher : Routine zoo in /tmp/foo/crasher/jni/zoo.c:13Stack frame #01 pc 000083fe /data/local/ndk-tests/crasher : Routine bar in /tmp/foo/crasher/jni/bar.c:5Stack frame #02 pc 000083f6 /data/local/ndk-tests/crasher : Routine my_comparison in /tmp/foo/crasher/jni/foo.c:9Stack frame #03 pc 000191ac /system/lib/libc.soStack frame #04 pc 000083ea /data/local/ndk-tests/crasher : Routine foo in /tmp/foo/crasher/jni/foo.c:14Stack frame #05 pc 00008458 /data/local/ndk-tests/crasher : Routine main in /tmp/foo/crasher/jni/main.c:19Stack frame #06 pc 0000d362 /system/lib/libc.so
IMPORTANT
The tool looks for the initial line containing starts in the logcat output, i.e.something this looks like:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
When copy/pasting traces, don’t forget this line from the traces, or ndk-stack won’t work correctly.
Now both the versions(linux/windows/mac) of ndk-stack are available at Android Developer .
References
$NDK_ROOT/docs/NDK-STACK.html
- Using NDK-STACK to Debug Cocos2dx Android Project
- Get Android stack trace from device using Debug Bridge
- How to import gms to our project - using Android.mk
- cocos2dx利用ndk-stack调试BUG
- android ndk-stack调试
- Android NDK-STACK Tool
- android ndk stack 使用
- How to Compile SQLite for Android using NDK
- Debug Android NDK code
- ndk-stack 分析 android crash stack
- Android ndk-stack tool使用
- Win7+Eclipse+Android+NDK+Cocos2dx
- Android NDK 建立cocos2dx项目
- Win7+Eclipse+Android+NDK+Cocos2dx
- (ZT) Using the Android NDK
- android ndk Using Existing Libraries
- android ndk Using Prebuilt Libraries
- How to detect compilation by android ndk in a C/C++ file? cocos2dx
- Android中解析XML
- VS2012运行C++程序出现fatal error LNK1104: 无法打开文件“kernel32.lib”错误
- 分享5款移动应用测试工具
- VS2008修改部分代码总重新编译整个工程或解决方案的问题解决
- Android4.2 静默安装应用
- Using NDK-STACK to Debug Cocos2dx Android Project
- 为什么要学习java
- 新手报到
- 基于SPRING构建J2EE框架
- iOS开发UI篇—UIScrollView控件实现图片轮播
- 在模拟器上运行一个64bit linux kernel(aarch64)
- Android OpenGL ES 2.0绘图:绘制纹理
- 我儿沈Feng以此特记我的博客之始
- Oracle中对两个数据表交集的查询(intersect和in)