标签:android style blog color io os 使用 ar sp
Android调用c++出现奔溃,崩溃信息为如下:
1 10-11 15:15:13.541 D/AudioMTKStreamOut( 139): write(), buffer = 0x42bd9390 bytes = 8192 mLatency = 92 2 10-11 15:15:13.562 I/PowerManagerService( 513): setBrightness mButtonLight, screenBrightness=245 3 10-11 15:15:13.575 I/DEBUG ( 9136): r0 40000001 r1 61e2a7a8 r2 becc2224 r3 becc2220 4 10-11 15:15:13.575 I/DEBUG ( 9136): r4 40000001 r5 61e2a7a8 r6 5f5501a0 r7 61e2a768 5 10-11 15:15:13.575 I/DEBUG ( 9136): r8 becc25bc r9 41b76d00 sl 41b70020 fp becc25d4 6 10-11 15:15:13.575 I/DEBUG ( 9136): ip 00000000 sp becc220c lr 60e6abd7 pc 610a672e cpsr 00000030 7 10-11 15:15:13.575 I/DEBUG ( 9136): 8 10-11 15:15:13.575 I/DEBUG ( 9136): backtrace: 9 10-11 15:15:13.575 I/DEBUG ( 9136): #00 pc 006d372e /data/data/com.linekong.dgr.langang/files/so_path/libgame.so (cocos2d::CCDictionary::setObject(cocos2d::CCObject*, std::string const&)+1) 10 10-11 15:15:13.575 I/DEBUG ( 9136): #01 pc 000203c4 [stack] 11 10-11 15:15:13.575 I/DEBUG ( 9136): 12 10-11 15:15:13.575 I/DEBUG ( 9136): stack: 13 10-11 15:15:13.575 I/DEBUG ( 9136): becc21cc 40049b30 /system/lib/libc.so (malloc+20) 14 10-11 15:15:13.575 I/DEBUG ( 9136): becc21d0 00000025 15 10-11 15:15:13.575 I/DEBUG ( 9136): becc21d4 612bfd8c /data/data/com.linekong.dgr.langang/files/so_path/libgame.so (operator new(unsigned int)+24) 16 10-11 15:15:13.575 I/DEBUG ( 9136): becc21d8 00000008 17 10-11 15:15:13.576 I/DEBUG ( 9136): becc21dc 61e2a794 18 10-11 15:15:13.576 I/DEBUG ( 9136): becc21e0 61e2a794 19 10-11 15:15:13.576 I/DEBUG ( 9136): becc21e4 612aa388 /data/data/com.linekong.dgr.langang/files/so_path/libgame.so 20 10-11 15:15:13.576 I/DEBUG ( 9136): becc21e8 61e2a7d4 21 10-11 15:15:13.576 I/DEBUG ( 9136): becc21ec 60eb781b /data/data/com.linekong.dgr.langang/files/so_path/libgame.so 22 10-11 15:15:13.576 I/DEBUG ( 9136): becc21f0 61e2a794 23 10-11 15:15:13.576 I/DEBUG ( 9136): becc21f4 00000008 24 10-11 15:15:13.576 I/DEBUG ( 9136): becc21f8 becc2220 [stack] 25 10-11 15:15:13.576 I/DEBUG ( 9136): becc21fc becc2224 [stack] 26 10-11 15:15:13.576 I/DEBUG ( 9136): becc2200 df002777 27 10-11 15:15:13.576 I/DEBUG ( 9136): becc2204 e3a070ad 28 10-11 15:15:13.576 I/DEBUG ( 9136): becc2208 61e2a768 29 10-11 15:15:13.576 I/DEBUG ( 9136): #00 becc220c 40000001 30 10-11 15:15:13.576 I/DEBUG ( 9136): becc2210 61e2a7a8 31 10-11 15:15:13.576 I/DEBUG ( 9136): becc2214 5f5501a0 32 10-11 15:15:13.576 I/DEBUG ( 9136): becc2218 61e2a768 33 10-11 15:15:13.576 I/DEBUG ( 9136): becc221c 60e6abd7 /data/data/com.linekong.dgr.langang/files/so_path/libgame.so (CCJsonData::setStringValue(std::string, std::string)+58) 34 10-11 15:15:13.576 I/DEBUG ( 9136): becc2220 5f5501a0 35 10-11 15:15:13.576 I/DEBUG ( 9136): becc2224 61e2a7d4 36 10-11 15:15:13.576 I/DEBUG ( 9136): becc2228 becc231c [stack] 37 10-11 15:15:13.576 I/DEBUG ( 9136): becc222c 614ba9f0 /data/data/com.linekong.dgr.langang/files/so_path/libgame.so
这时候我们怎么查看奔溃点呢,可以使用address2line。
我的是mac版本的NDK_r8e,它的位置在
$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86_64/bin
;
你可以把这个路径添加到环境变量中,然后在工程的根目录下执行如下命令了。
arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libXXX.so <address>
这边的address是崩溃的起始点,#00 pc开头的后面的那个地址。像我们可以看第9行的崩溃信息得到地址006d372e。
arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libXXX.so 006d372e
可以看到最后等到下面这样的信息
./arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libgame.so 006d372e
cocos2d::CCDictionary::setObject(cocos2d::CCObject*, std::string const&)
/Users/chuanwei/project/battlegirl/project/BattleGirl/proj.android/game/../../../cocos2dx/cocoa/CCDictionary.cpp:213
最后找到问题了。
address2line 定位 Android c++奔溃位置
标签:android style blog color io os 使用 ar sp
原文地址:http://www.cnblogs.com/chuanwei-zhang/p/4021817.html