1,用logcat获取log
比如把下面crash的信息保存为log.txt
I/DEBUG(27306): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG(27306): Build fingerprint: 'ZTE/P117A20/P117A20:4.0.4/IMM76D/eng.root.20130319.174723:user/release-keys'
I/DEBUG(27306): pid: 18437, tid: 19254 >>> com.dreamprj.defender.v6 <<<
I/DEBUG(27306): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG(27306): r0 51c0cab0 r1 013d8958 r2 51ab85f0 r3 00000000
I/DEBUG(27306): r4 00cc4138 r5 00000000 r6 00dc5c78 r7 3ca3b363
I/DEBUG(27306): r8 51c0cc08 r9 4bfa5f54 10 00000008 fp 51c0cc1c
I/DEBUG(27306): ip 0000007b sp 51c0caa0 lr 517f7171 pc 517f7170 cpsr 40000030
W/AudioFlinger(103): no activetracks ready,sleep 8 ms
W/AudioFlinger(103): no activetracks ready,sleep 8 ms
V/ActivityManager(236): Broadcast sticky: Intent { act=android.intent.action.SIG_STR flg=0x20000010 (has extras) } ordered=false
D/StatusBar.NetworkController(315): athens iconLevel=5 mInetCondition= 0 IS_CMCC=true
D/Bluetooth HS/HF(415): [BT][HFG] [API] mStateReceiver.onReceive(android.intent.action.SIG_STR)
D/Bluetooth HS/HF(415): [BT][HFG] [API] mHandler.handleMessage(10)
D/TelephonyManager(315): getDefaultSim is sim1
D/StatusBar.NetworkController(315): refreshViews(): mDataConnected = false mDataActivity = 0.
W/AudioFlinger(103): no activetracks ready,sleep 8 ms
W/AudioFlinger(103): no activetracks ready,sleep 8 ms
W/AudioFlinger(103): no activetracks ready,sleep 8 ms
I/DEBUG(27306): #00 pc 0016b170 /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so (_ZN10ShouRenGjs5shootEv)
I/DEBUG(27306): #01 lr 517f7171 /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): code around pc:
I/DEBUG(27306): 517f7150 f07158d5 1c01fe11 47a81c20 23b76822 .Xq..... ..G"h.#
I/DEBUG(27306): 517f7160 58d3009b 47981c20 a8041c05 f892f04b ...X ..G....K...
I/DEBUG(27306): 517f7170 1c28682b 6d1b27f8 1c014798 f04ba804 +h(..'.m.G....K.
I/DEBUG(27306): 517f7180 682af905 009b23b3 1c2858d3 47989e05 ..*h.#...X(....G
I/DEBUG(27306): 517f7190 1c301c01 ec60f211 90051c29 f0161c20 ..0...`.)... ...
I/DEBUG(27306): code around lr:
I/DEBUG(27306): 517f7150 f07158d5 1c01fe11 47a81c20 23b76822 .Xq..... ..G"h.#
I/DEBUG(27306): 517f7160 58d3009b 47981c20 a8041c05 f892f04b ...X ..G....K...
I/DEBUG(27306): 517f7170 1c28682b 6d1b27f8 1c014798 f04ba804 +h(..'.m.G....K.
I/DEBUG(27306): 517f7180 682af905 009b23b3 1c2858d3 47989e05 ..*h.#...X(....G
I/DEBUG(27306): 517f7190 1c301c01 ec60f211 90051c29 f0161c20 ..0...`.)... ...
I/DEBUG(27306): stack:
I/DEBUG(27306): 51c0ca60 008f2d08 [heap]
I/DEBUG(27306): 51c0ca64 013d8958 [heap]
I/DEBUG(27306): 51c0ca68 00000001
I/DEBUG(27306): 51c0ca6c 51844fad /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca70 00000001
I/DEBUG(27306): 51c0ca74 5184293b /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca78 013d8958 [heap]
I/DEBUG(27306): 51c0ca7c 51842aeb /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca80 013d8958 [heap]
I/DEBUG(27306): 51c0ca84 5184456f /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca88 013d8958 [heap]
I/DEBUG(27306): 51c0ca8c 51868da7 /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca90 00cc4138 [heap]
I/DEBUG(27306): 51c0ca94 517f6dff /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0ca98 df0027ad
I/DEBUG(27306): 51c0ca9c 00000000
I/DEBUG(27306): #00 51c0caa0 51c0cb04
I/DEBUG(27306): 51c0caa4 00e2b290 [heap]
I/DEBUG(27306): 51c0caa8 00d9e1f0 [heap]
I/DEBUG(27306): 51c0caac 5180bf09 /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0cab0 00000000
I/DEBUG(27306): 51c0cab4 00000000
I/DEBUG(27306): 51c0cab8 3ca3b363
I/DEBUG(27306): 51c0cabc 517fec6d /data/data/com.dreamprj.defender.v6/lib/libhellocpp.so
I/DEBUG(27306): 51c0cac0 00e2b290 [heap]
I/DEBUG(27306): 51c0cac4 51c0cb04
I/DEBUG(27306): 51c0cac8 00000000
I/DEBUG(27306): 51c0cacc 3ca3b363
I/DEBUG(27306): 51c0cad0 00e2b290 [heap]
I/DEBUG(27306): 51c0cad4 00cbea49 [heap]
I/DEBUG(27306): 51c0cad8 00000038
I/DEBUG(27306): 51c0cadc 00000038
I/DEBUG(27306): 51c0cae0 00000038
I/DEBUG(27306): 51c0cae4 51c0cc08
2,输入命令
$NDK/ndk-stack -sym $PROJECT_PATH/obj/local/armeabi -dump log.txt
便翻译成
D:\>C:/android-ndk-r9c/ndk-stack -sym e:/work/DreamStudio/knight_new/client/src/
main_version/projects/dgamePushZR/proj.android/obj/local/armeabi -dump log3.txt
********** Crash dump: **********
Build fingerprint: 'ZTE/P117A20/P117A20:4.0.4/IMM76D/eng.root.20130319.174723:us
er/release-keys'
pid: 4953, tid: 4969 >>> com.dreamprj.defender.v6 <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame 12-19 16:37:40.032: I/DEBUG(18426): #00 pc 0016b170 /data
/data/com.dreamprj.defender.v6/lib/libhellocpp.so (_ZN10ShouRenGjs5shootEv): Rou
tine ShouRenGjs::shoot() at E:\work\DreamStudio\knight_new\client\src\main_versi
on\projects\dgamePushZR\proj.android/jni/../../Classes/enemy/ShouRenGjs.cpp:71