address2line 定位 Android c++奔潰位置

來源:互聯網
上載者:User

標籤: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  0000002515 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  0000000817 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21dc  61e2a79418 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21e0  61e2a79419 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21e4  612aa388  /data/data/com.linekong.dgr.langang/files/so_path/libgame.so20 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21e8  61e2a7d421 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21ec  60eb781b  /data/data/com.linekong.dgr.langang/files/so_path/libgame.so22 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21f0  61e2a79423 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc21f4  0000000824 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  df00277727 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2204  e3a070ad28 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2208  61e2a76829 10-11 15:15:13.576 I/DEBUG   ( 9136):     #00  becc220c  4000000130 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2210  61e2a7a831 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2214  5f5501a032 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2218  61e2a76833 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  5f5501a035 10-11 15:15:13.576 I/DEBUG   ( 9136):          becc2224  61e2a7d436 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++奔潰位置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.