在android本机堆栈跟踪中找到错误

时间:2011-11-01 09:14:54

标签: android android-ndk

我的应用有问题。

我的活动不是本机活动,而是在java线程run()方法中调用本机代码(并且它将在所有活动生命周期中继续运行) 有时,活动以静默方式崩溃(没有任何提示)ancd返回到我的应用程序的上一个活动。 我在tracelog上徘徊,但是使用ndk-trace只能去掉libc.so中的调用, 我在“堆栈”中看到一些调用我的本机库,有一种方法可以从堆栈中恢复我的源中发生崩溃的区域的一些指示吗?

11-01 07:54:43.670: I/DEBUG(28785): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***                                 
11-01 07:54:43.670: I/DEBUG(28785): Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.5/GINGERBREAD/XWKI8:user/release-keys'        
11-01 07:54:43.670: I/DEBUG(28785): pid: 28798, tid: 6728  >>> dalmax.games.turnBasedGames.checkers <<<                             
11-01 07:54:43.670: I/DEBUG(28785): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad                                  
11-01 07:54:43.670: I/DEBUG(28785):  r0 00000027  r1 deadbaad  r2 a0000000  r3 00000000                                             
11-01 07:54:43.670: I/DEBUG(28785):  r4 00000001  r5 00000000  r6 4cf15c10  r7 00000000                                             
11-01 07:54:43.670: I/DEBUG(28785):  r8 4cf15b70  r9 479a0fac  10 479a0f94  fp 4cf158b4                                             
11-01 07:54:43.670: I/DEBUG(28785):  ip afd466a8  sp 4cf15860  lr afd196f1  pc afd161c0  cpsr 60000030                              
11-01 07:54:43.670: I/DEBUG(28785):  d0  414000003f800000  d1  0001000140d00000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d2  00ff00ff00ff00ff  d3  00ff00ff00ff00ff                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d4  0000000000000000  d5  0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d6  4110000000000000  d7  0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d8  000025cb6997a050  d9  0000003244480000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d10 3fc0000042960000  d11 4052c00000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d12 0000000000000000  d13 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d14 0000000000000000  d15 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d16 0000000700000001  d17 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d18 0000000000000000  d19 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d20 0000000000000000  d21 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d22 0000000000000000  d23 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d24 0000000000000000  d25 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d26 0000000000000000  d27 0000000000000000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d28 0002aaa80002aaa8  d29 0002aaa80002aaa8                                                     
11-01 07:54:43.670: I/DEBUG(28785):  d30 0001000000010000  d31 0001000000010000                                                     
11-01 07:54:43.670: I/DEBUG(28785):  scr 20000010                                                                                   
11-01 07:54:43.740: I/DEBUG(28785):          #00  pc 000161c0  /system/lib/libc.so                                                  
11-01 07:54:43.740: I/DEBUG(28785):          #01  lr afd196f1  /system/lib/libc.so                                                  
11-01 07:54:43.740: I/DEBUG(28785): code around pc:                                                                                 
11-01 07:54:43.740: I/DEBUG(28785): afd161a0 2c006824 e028d1fb b13368db c064f8df                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd161b0 44fc2401 4000f8cc 49124798 25002027                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd161c0 f7f57008 2106ea16 eb8af7f6 460aa901                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd161d0 f04f2006 95015380 95029303 eef0f7f5                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd161e0 462aa905 f7f52002 f7f5eefc 2106ea02                                                    
11-01 07:54:43.740: I/DEBUG(28785): code around lr:                                                                                 
11-01 07:54:43.740: I/DEBUG(28785): afd196d0 4a0e4b0d e92d447b 589c41f0 26004680                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd196e0 686768a5 f9b5e006 b113300c 47c04628                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd196f0 35544306 37fff117 6824d5f5 d1ef2c00                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd19700 e8bd4630 bf0081f0 00027e6c ffffff88                                                    
11-01 07:54:43.740: I/DEBUG(28785): afd19710 b086b570 f602fb01 9004460c a804a901                                                    
11-01 07:54:43.740: I/DEBUG(28785): stack:                                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15820  afd426a4                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15824  000b6ec8                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15828  00000015                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1582c  afd187b9  /system/lib/libc.so                                                     
11-01 07:54:43.740: I/DEBUG(28785):     4cf15830  afd4274c                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15834  afd426f8                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15838  00000000                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1583c  afd196f1  /system/lib/libc.so                                                     
11-01 07:54:43.740: I/DEBUG(28785):     4cf15840  00000001                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15844  4cf15874                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15848  4cf15c10                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1584c  00000000                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15850  4cf15b70                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15854  afd18a13  /system/lib/libc.so                                                     
11-01 07:54:43.740: I/DEBUG(28785):     4cf15858  df002777                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1585c  e3a070ad                                                                          
11-01 07:54:43.740: I/DEBUG(28785): #00 4cf15860  4cf158b4                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15864  afd18e01  /system/lib/libc.so                                                     
11-01 07:54:43.740: I/DEBUG(28785):     4cf15868  00596970                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1586c  4cf15878                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15870  00000001                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15874  fffffbdf                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15878  8163d852  /data/data/dalmax.games.turnBasedGames.checkers/lib/libcheckersEngine.so
11-01 07:54:43.740: I/DEBUG(28785):     4cf1587c  8164301c                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15880  000001dc                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15884  8162f960  /data/data/dalmax.games.turnBasedGames.checkers/lib/libcheckersEngine.so
11-01 07:54:43.740: I/DEBUG(28785):     4cf15888  8162f7ec  /data/data/dalmax.games.turnBasedGames.checkers/lib/libcheckersEngine.so
11-01 07:54:43.740: I/DEBUG(28785):     4cf1588c  8163d71c  /data/data/dalmax.games.turnBasedGames.checkers/lib/libcheckersEngine.so
11-01 07:54:43.740: I/DEBUG(28785):     4cf15890  0000001b                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15894  003820a8                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf15898  00000000                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf1589c  4cf15c10                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf158a0  479a0fb4                                                                          
11-01 07:54:43.740: I/DEBUG(28785):     4cf158a4  8162ee10  /data/data/dalmax.games.turnBasedGames.checkers/lib/libcheckersEngine.so

1 个答案:

答案 0 :(得分:3)

好的,我解决了这个问题。

我的重载操作符new中出现错误,使用的静态成员未受锁保护,因此当从我的本机代码中删除对象时,同时从JNI中删除了另一个对象界面线程,kaboom!

我没有找到任何有用的方法来从错误报告中解决此问题。 为了解决这个问题,我已经在Visual Studio中复制了这种情况,(使用2个线程,尝试调用jni接口的相同方法,如果它们没有在visual studio测试项目中使用),以了解是什么问题

无论如何,最后我可以发布我的应用程序: - )