Android调试运行时错误之Process XXX terminated by signal (11)

Android调试运行时错误之Process XXX terminated by signal (11)

 

作者   朱先忠


最近使用C++开发Android程序,发现在Eclipse环境下进行Native代码调试相当困难,但也不是绝对没有路可走。

其中的困难之一便是,你需要时常面对native程序的崩溃问题,真真不点“简直是令程序员崩溃”。Android java程序在异常之前还打印出代码调用栈,让程序员有迹可寻,结合单步调试,定位问题相对容易些。而native程序崩溃,只会打印出一段天书,让人摸不着头脑。比如,下面就是一段native程序异常后,在logcat中打印出的信息:


04-30 15:30:20.820: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libwiskia.so 0x4051cbf0

04-30 15:30:20.820: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libwiskia.so 0x4051cbf0

04-30 15:30:20.820: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libwiskia.so 0x4051cbf0, skipping init
04-30 15:30:20.825: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libxml2.so 0x4051cbf0
04-30 15:30:20.825: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libxml2.so 0x4051cbf0
04-30 15:30:20.825: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libxml2.so 0x4051cbf0, skipping init
04-30 15:30:20.825: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so 0x4051cbf0
04-30 15:30:20.830: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so 0x4051cbf0
04-30 15:30:20.830: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so 0x4051cbf0, skipping init
04-30 15:30:20.830: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/liblua.so 0x4051cbf0
04-30 15:30:20.840: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/liblua.so 0x4051cbf0
04-30 15:30:20.840: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/liblua.so 0x4051cbf0, skipping init
04-30 15:30:20.840: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libchipmunk.so 0x4051cbf0
04-30 15:30:20.840: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libchipmunk.so 0x4051cbf0
04-30 15:30:20.840: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libchipmunk.so 0x4051cbf0, skipping init
04-30 15:30:20.845: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libbox2d.so 0x4051cbf0
04-30 15:30:20.845: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libbox2d.so 0x4051cbf0
04-30 15:30:20.845: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libbox2d.so 0x4051cbf0, skipping init
04-30 15:30:20.845: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libwisound.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libwisound.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libwisound.so 0x4051cbf0, skipping init
04-30 15:30:20.850: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libwinetwork.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libwinetwork.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libwinetwork.so 0x4051cbf0, skipping init
04-30 15:30:20.850: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libjson.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libjson.so 0x4051cbf0
04-30 15:30:20.850: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libjson.so 0x4051cbf0, skipping init
04-30 15:30:20.850: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libiap.so 0x4051cbf0
04-30 15:30:20.855: D/dalvikvm(9419): Added shared lib /data/data/com.zxz.AngryBirds_native3/lib/libiap.so 0x4051cbf0
04-30 15:30:20.855: D/dalvikvm(9419): No JNI_OnLoad found in /data/data/com.zxz.AngryBirds_native3/lib/libiap.so 0x4051cbf0, skipping init

04-30 15:30:20.855: D/dalvikvm(9419): Trying to load lib /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so 0x4051cbf0
04-30 15:30:20.955: I/DEBUG(2581): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-30 15:30:20.955: I/DEBUG(2581): Build fingerprint: ‘samsung/GT-I9100/GT-I9100:2.3.4/GINGERBREAD/ZCKG4:user/release-keys‘
04-30 15:30:20.955: I/DEBUG(2581): pid: 9419, tid: 9419  >>> com.zxz.AngryBirds_native3 <<<
04-30 15:30:20.955: I/DEBUG(2581): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
04-30 15:30:20.955: I/DEBUG(2581):  r0 00000000  r1 00147678  r2 00000006  r3 00000006

04-30 15:30:20.955: I/DEBUG(2581):  r4 00000006  r5 00147678  r6 00000000  r7 82019073
04-30 15:30:20.955: I/DEBUG(2581):  r8 00094418  r9 81936444  10 be9bbfe4  fp 00000001
04-30 15:30:20.955: I/DEBUG(2581):  ip 8193660c  sp be9bbeb0  lr 818c589b  pc 818c589c  cpsr 60000030
04-30 15:30:20.955: I/DEBUG(2581):  d0  437000004271872b  d1  3ff00000000000f0
04-30 15:30:20.960: I/DEBUG(2581):  d2  3f000000cf000000  d3  42c8000000540ff0
04-30 15:30:20.960: I/DEBUG(2581):  d4  437000000027b190  d5  3fc000003fc00000
04-30 15:30:20.960: I/DEBUG(2581):  d6  4515a00043700000  d7  000000003f800000
04-30 15:30:20.960: I/DEBUG(2581):  d8  0000000000000000  d9  0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d10 0000000000000000  d11 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d12 0000000000000000  d13 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d14 0000000000000000  d15 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d16 000000c24007be48  d17 3fe999999999999a
04-30 15:30:20.960: I/DEBUG(2581):  d18 42eccefa43de3400  d19 3fbc71c71c71c71c
04-30 15:30:20.960: I/DEBUG(2581):  d20 4008000000000000  d21 3fd99a27ad32ddf5
04-30 15:30:20.960: I/DEBUG(2581):  d22 3fd24998d6307188  d23 3fcc7288e957b53b
04-30 15:30:20.960: I/DEBUG(2581):  d24 3fc74721cad6b0ed  d25 3fc39a09d078c69f
04-30 15:30:20.960: I/DEBUG(2581):  d26 0000000000000000  d27 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d28 0000000000000000  d29 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  d30 0000000000000000  d31 0000000000000000
04-30 15:30:20.960: I/DEBUG(2581):  scr 60000010
04-30 15:30:21.095: I/DEBUG(2581):          #00  pc 000c589c  /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so
04-30 15:30:21.095: I/DEBUG(2581):          #01  pc 000c5a3e  /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so
04-30 15:30:21.095: I/DEBUG(2581):          #02  pc 0000ea14  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.095: I/DEBUG(2581): code around pc:

04-30 15:30:21.095: I/DEBUG(2581): 818c587c b154ee20 205f2200 5ca94613 bf08292d

04-30 15:30:21.095: I/DEBUG(2581): 818c588c 330154a8 461a42a3 f7fdd1f7 4629fac5
04-30 15:30:21.095: I/DEBUG(2581): 818c589c 46046803 329cf8d3 68234798 f8d34641
04-30 15:30:21.095: I/DEBUG(2581): 818c58ac 4607329c 47984620 2e009003 6823d062
04-30 15:30:21.095: I/DEBUG(2581): 818c58bc 46204631 329cf8d3 46064798 fc7cf7f9
04-30 15:30:21.095: I/DEBUG(2581): code around lr:
04-30 15:30:21.095: I/DEBUG(2581): 818c5878 f7ae4605 b154ee20 205f2200 5ca94613
04-30 15:30:21.095: I/DEBUG(2581): 818c5888 bf08292d 330154a8 461a42a3 f7fdd1f7
04-30 15:30:21.095: I/DEBUG(2581): 818c5898 4629fac5 46046803 329cf8d3 68234798
04-30 15:30:21.095: I/DEBUG(2581): 818c58a8 f8d34641 4607329c 47984620 2e009003
04-30 15:30:21.100: I/DEBUG(2581): 818c58b8 6823d062 46204631 329cf8d3 46064798
04-30 15:30:21.100: I/DEBUG(2581): stack:
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe70  00094418 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe74  81936444 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe78  be9bbfe4 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe7c  afd14183  /system/lib/libc.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe80  00147678 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe84  00147678 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe88  00000007 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe8c  00000000 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe90  82019073  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe94  afd141f7  /system/lib/libc.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe98  00000006 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbe9c  00000000 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbea0  00000006 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbea4  00147678 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbea8  df002777 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbeac  e3a070ad 
04-30 15:30:21.100: I/DEBUG(2581): #00 be9bbeb0  be9bbfe4 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbeb4  afd14183  /system/lib/libc.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbeb8  00094418 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbebc  00094418 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbec0  82019072  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbec4  00000008 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbec8  82019072  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbecc  00094418 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbed0  8201906a  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.100: I/DEBUG(2581):     be9bbed4  00000000 
04-30 15:30:21.100: I/DEBUG(2581):     be9bbed8  be9bc0c0 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbedc  be9bbfe4 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbee0  00000001 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbee4  818c5a43  /data/data/com.zxz.AngryBirds_native3/lib/libwiengine.so
04-30 15:30:21.105: I/DEBUG(2581): #01 be9bbee8  8201b008 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbeec  00000004 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbef0  00000004 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbef4  000b8822 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbef8  00000000 
04-30 15:30:21.105: I/DEBUG(2581):     be9bbefc  8200ea17  /data/data/com.zxz.AngryBirds_native3/lib/libAngryBirds_native3.so
04-30 15:30:21.525: I/DEBUG(2581): gotoUploadUserFault called
04-30 15:30:21.525: I/BootReceiver(2702): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
04-30 15:30:21.530: I/dumpstate(9450): begin
04-30 15:30:22.930: W/WindowManager(2702): App freeze timeout expired.
04-30 15:30:22.930: W/WindowManager(2702): Force clearing freeze: AppWindowToken{40afc4c0 token=HistoryRecord{4083fd38 com.zxz.AngryBirds_native3/.AngryBirds_native3Activity}}
04-30 15:30:25.060: D/dalvikvm(2702): GC_EXPLICIT freed 1166K, 43% free 6920K/11975K, external 2310K/2327K, paused 116ms
04-30 15:30:25.155: D/VoldCmdListener(2578): asec list
04-30 15:30:26.455: I/dumpstate(9450): done
04-30 15:30:26.525: I/ActivityManager(2702): Process com.zxz.AngryBirds_native3 (pid 9419) has died.........................▲▲


04-30 15:30:26.540: W/WindowManager(2702): Window Window{408111a0 Starting com.zxz.AngryBirds_native3 paused=false} destroyed surface
Surface(name=Starting com.zxz.AngryBirds_native3, identity=-1, mNativeSurface=0), session Session{40541ce0 uid 1000}

04-30 15:30:26.555: D/Zygote(2585): Process 9419 terminated by signal (11)

以上是我使用文件导出的LogCat的最关键的输出的部分。根据我的一点经验,及从网络上搜索的部分资源(如下):

1,android 启动过程(http://www.j-cn.org/post/444.html)
2,使用ndk-stack追踪程序崩溃(http://mogoweb.net/archives/133)
3,Android 碰到signal 11,提示Process xxx has died,的问题。 (http://blog.csdn.net/win2k3net/article/details/6718591)
4,getting SIGNAL 11 error(http://stackoverflow.com/questions/5777767/getting-signal-11-error)

来推断,出现如题目中所示错误的最主要原因是自定义的.SO库(即Native代码构建的库)中一般存在内存漏洞,或者内存占用太大,从而导致系统堆栈溢出(即上述引用中所说的“栈被撑破”)所致。

因此,接下来检查的重点应当是复杂数据结构及相关指针的操作问题。

(转)Android调试运行时错误之Process XXX terminated by signal (11),,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。