当前位置:操作系统 > 安卓/Android >>

linux程序崩溃调试技术

作者:宋文生             2012-2-13
 
一,起因
 
在开发android的ril过程中,遇到了rild异常崩溃的现象。该进程直接控制android RIL相关的所有操作,如果异常终止,将导致android framework的重启。
 
二,细节
 
a)         众所周知,linux的程序崩溃时,都会打印出崩溃前的stack trace。该stack  trace是我们寻找崩溃原因的重要线索。
 
b)        以下是android rild的崩溃细节
 
01-19 17:48:56.550 I/DEBUG ( 683): Build fingerprint: 'augusta/M70P/m70p/miracle_smt:2.2/M70P-daily/20120119:user/test-keys'
01-19 17:48:56.550 I/DEBUG ( 683): pid: 684, tid: 715 >>> /system/bin/rild <<<
01-19 17:48:56.550 I/DEBUG ( 683): signal 11 (SIGSEGV), fault addr deadbaad
01-19 17:48:56.550 I/DEBUG ( 683): r0 00000000 r1 0000000c r2 00000027 r3 00000000
01-19 17:48:56.550 I/DEBUG ( 683): r4 afd40328 r5 deadbaad r6 00001728 r7 00000000
01-19 17:48:56.550 I/DEBUG ( 683): r8 00100000 r9 ae60532d 10 10000000 fp 00000000
01-19 17:48:56.550 I/DEBUG ( 683): ip ffffffff sp 100ffcf0 lr afd154e1 pc afd11dee cpsr 00000030
01-19 17:48:56.560 W/InputManagerService( 887): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45ffbd88
01-19 17:48:56.580 I/DEBUG ( 683): #00 pc 00011dee /system/lib/libc.so
01-19 17:48:56.580 I/DEBUG ( 683): #01 pc 0000be1c /system/lib/libc.so
01-19 17:48:56.580 I/DEBUG ( 683):
01-19 17:48:56.580 I/DEBUG ( 683): code around pc:
01-19 17:48:56.580 I/DEBUG ( 683): afd11dcc 2d00d10d 1c2bd00b 2d00682d e026d1fb
01-19 17:48:56.580 I/DEBUG ( 683): afd11ddc 2b0068db 4e17d003 51a02001 4d164798
01-19 17:48:56.580 I/DEBUG ( 683): afd11dec 702a2227 edfef7fb f7fc2106 2380ef1c
01-19 17:48:56.580 I/DEBUG ( 683): afd11dfc aa010559 60912400 1c116054 94012006
01-19 17:48:56.580 I/DEBUG ( 683): afd11e0c eaa0f7fc 2200a905 f7fc2002 f7fbeaac
01-19 17:48:56.580 I/DEBUG ( 683):
01-19 17:48:56.580 I/DEBUG ( 683): code around lr:
01-19 17:48:56.580 I/DEBUG ( 683): afd154c0 447b4a0d 589cb083 26009001 686768a5
01-19 17:48:56.580 I/DEBUG ( 683): afd154d0 220ce008 2b005eab 1c28d003 47889901
01-19 17:48:56.590 I/DEBUG ( 683): afd154e0 35544306 d5f43f01 2c006824 b003d1ee
01-19 17:48:56.590 I/DEBUG ( 683): afd154f0 bdf01c30 0002ae62 000000d4 1c0fb5f0
01-19 17:48:56.590 I/DEBUG ( 683): afd15500 43551c3d a904b087 1c16ac01 604d9004
01-19 17:48:56.590 I/DEBUG ( 683):
01-19 17:48:56.590 I/DEBUG ( 683): stack:
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb0 00000718
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb4 afd1455b /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb8 afd405a0 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcbc afd4054c /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc4 afd154e1 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc8 00000071
01-19 17:48:56.590 I/DEBUG ( 683): 100ffccc afd1452d /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd4 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd8 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcdc 00001728
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce4 afd147cb /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce8 df002777
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcec e3a070ad
01-19 17:48:56.590 I/DEBUG ( 683): #00 100ffcf0 0000b4e8 [heap]
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcf4 c0000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcf8 afd418dc /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcfc afd10538 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd00 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd04 fffffbdf
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd08 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd0c afd41724 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd10 0000b000 [heap]
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd14 afd0be21 /system/lib/libc.so
01-19 17:48:56.600 I/DEBUG ( 683): #01 100ffd18 afd40328 /system/lib/libc.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd1c afd0be21 /system/lib/libc.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd20 00000002
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd24 0000b4ee [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd28 0000c574 [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd2c 0000b4e8 [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd30 0000c574 [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd34 00000006
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd38 000013fc
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd3c af9059ff /system/lib/libcutils.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd40 0000b4e8 [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd44 800056b5 /system/lib/libaugusta-ril.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd48 100ffd6c
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd4c 0000b438 [heap]
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd50 ae6089bc /system/lib/libril.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd54 afd0cd81 /system/lib/libc.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd58 800056b5 /system/lib/libaugusta-ril.so
01-19 17:48:56.600 I/DEBUG ( 683): 100ffd5c ae6042a3 /system/lib/libril.so
 
 
 
 
 
 
 
 
 
 
 
 
 
三,分析
 
       幸运的话,我们可以在这个log的前3行,知道崩溃的原因。但更多细节需要我们自己去查。
 
       堆栈记录:
 
     
 
01-19 17:48:56.590 I/DEBUG ( 683): stack:
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb0 00000718
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb4 afd1455b /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcb8 afd405a0 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcbc afd4054c /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc4 afd154e1 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcc8 00000071
01-19 17:48:56.590 I/DEBUG ( 683): 100ffccc afd1452d /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd4 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcd8 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcdc 00001728
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce0 00000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce4 afd147cb /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffce8 df002777
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcec e3a070ad
01-19 17:48:56.590 I/DEBUG ( 683): #00 100ffcf0 0000b4e8 [heap]
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcf4 c0000000
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcf8 afd418dc /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffcfc afd10538 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd00 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd04 fffffbdf
01-19 17:48:56.590 I/DEBUG ( 683): 100ffd08 afd40328 /system/lib/libc.so
01-19 17:48:56.590 I/DEBUG ( 683): 100ff
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,