emax79
emax79

Reputation: 318

find error in android native stack trace

I have some problem with my app.

My activity is not a native activity but call native code in a java thread run() method (and it will continue to run during all activity lifecycle) Sometime the activity silently crash (without any prompt) ancd go back to previous activity of my application. I am indagating on the tracelog, but using ndk-trace only get rid of the call in libc.so, I see in the "stack" some call to my native lib, there is a way to recover some indication of the zone where the crash happen in my source from the stack?

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

Upvotes: 2

Views: 1039

Answers (1)

emax79
emax79

Reputation: 318

Ok, I solved the problem.

It was an error in my overloaded operator new, using a static member which was not protected with a lock, so that when an object was deleted from my native code, and at the same time an other object was deleted from the JNI interface thread, kaboom!

I have not found any usefull way to solve this issue from the error reports. To solve it I have replicated the situation in Visual Studio, (using 2 threads, and trying to call the same methods of the jni interface, also if they are not used in the visual studio test project) to get an idea of what was the problem.

Anyway at the end I can publish my app :-)

Upvotes: 3

Related Questions