[cfe-dev] Crash reason (Java-JNI-Clang C API)?

Anton Smirnov dev at antonsmirnov.name
Tue Dec 10 09:16:07 PST 2013


i'm developing android app that uses Clang via C API (libclang) for ARM.
I've wrote wrapper toinvoke clang_..() functions and map data between
Java<->native code. So the app is working for few times and then crashing.
It's interacting with native code from java background thread (if that
helps).

My idea about what's wrong is:

   1. i'm trying to delete already deleted pointer
   2. there is a memory leak in my code/clang and heap is fully allocated
   3. concurrency issue

Any thoughts are highly appreciated:


12-10 23:03:55.382: ASSERT/libc(2763): Fatal signal 11 (SIGSEGV) at
0x00000acb (code=0), thread 3690 (Thread-545)
// ...
12-10 23:03:55.883: INFO/DEBUG(167): backtrace:12-10 23:03:55.883:
INFO/DEBUG(167): #00  pc 0017b198
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so
(clang::cxdiag::lazyCreateDiags(CXTranslationUnitImpl*,
bool)+200)12-10 23:03:55.883: INFO/DEBUG(167): #01  pc 00009028
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang_wrapper.so
(Java_name_antonsmirnov_clang_clang_1wrapper_getDiagnostics+72)12-10
23:03:55.883: INFO/DEBUG(167): #02  pc 0001fb70  /system/lib/libdvm.so
(dvmPlatformInvoke+112)12-10 23:03:55.883: INFO/DEBUG(167): #03  pc
0004e8b9  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*,
JValue*, Method const*, Thread*)+360)12-10 23:03:55.883:
INFO/DEBUG(167): #04  pc 00029020  /system/lib/libdvm.so12-10
23:03:55.883: INFO/DEBUG(167): #05  pc 0002d7e8  /system/lib/libdvm.so
(dvmInterpret(Thread*, Method const*, JValue*)+180)12-10 23:03:55.883:
INFO/DEBUG(167): #06  pc 0005fed5  /system/lib/libdvm.so
(dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*,
std::__va_list)+272)12-10 23:03:55.883: INFO/DEBUG(167): #07  pc
0005feff  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*,
Object*, JValue*, ...)+20)12-10 23:03:55.883: INFO/DEBUG(167): #08  pc
00055327  /system/lib/libdvm.so12-10 23:03:55.883: INFO/DEBUG(167):
#09  pc 00012e70  /system/lib/libc.so (__thread_entry+48)12-10
23:03:55.883: INFO/DEBUG(167): #10  pc 000125c8  /system/lib/libc.so
(pthread_create+172)12-10 23:03:55.883: INFO/DEBUG(167): stack:12-10
23:03:55.883: INFO/DEBUG(167): 76475be0  0000000412-10 23:03:55.883:
INFO/DEBUG(167): 76475be4  1d30000512-10 23:03:55.883:
INFO/DEBUG(167): 76475be8  76475c04  [stack:3690]12-10 23:03:55.883:
INFO/DEBUG(167): 76475bec  735086e012-10 23:03:55.883:
INFO/DEBUG(167): 76475bf0  731a51c812-10 23:03:55.883:
INFO/DEBUG(167): 76475bf4  0000000012-10 23:03:55.883:
INFO/DEBUG(167): 76475bf8  731a3f4812-10 23:03:55.883:
INFO/DEBUG(167): 76475bfc  76475c80  [stack:3690]12-10 23:03:55.883:
INFO/DEBUG(167): 76475c00  7373df3012-10 23:03:55.883:
INFO/DEBUG(167): 76475c04  7160ca8812-10 23:03:55.883:
INFO/DEBUG(167): 76475c08  76475c7c  [stack:3690]12-10 23:03:55.883:
INFO/DEBUG(167): 76475c0c  40137ff1  /system/lib/libc.so
(malloc+12)12-10 23:03:55.883: INFO/DEBUG(167): 76475c10  75fcda38
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so12-10
23:03:55.883: INFO/DEBUG(167): 76475c14  402028ff
/system/lib/libstdc++.so (operator new[](unsigned int)+6)12-10
23:03:55.883: INFO/DEBUG(167): 76475c18  df0027ad12-10 23:03:55.883:
INFO/DEBUG(167): 76475c1c  0000000012-10 23:03:55.883:
INFO/DEBUG(167): #00  76475c20  1d30000512-10 23:03:55.883:
INFO/DEBUG(167): 76475c24  7308de7812-10 23:03:55.883:
INFO/DEBUG(167): 76475c28  76475c54  [stack:3690]12-10 23:03:55.883:
INFO/DEBUG(167): 76475c2c  715ebdb0
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang_wrapper.so
(unmapTranslationUnit+56)12-10 23:03:55.883: INFO/DEBUG(167): 76475c30
 7308de7812-10 23:03:55.883: INFO/DEBUG(167): 76475c34  715f1620
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang_wrapper.so12-10
23:03:55.883: INFO/DEBUG(167): 76475c38  1d20000512-10 23:03:55.883:
INFO/DEBUG(167): 76475c3c  0008de7812-10 23:03:55.883:
INFO/DEBUG(167): 76475c40  1d30000512-10 23:03:55.883:
INFO/DEBUG(167): 76475c44  6da271c0  /dev/ashmem/dalvik-LinearAlloc
(deleted)12-10 23:03:55.883: INFO/DEBUG(167): 76475c48  7160ca7812-10
23:03:55.883: INFO/DEBUG(167): 76475c4c  0000000412-10 23:03:55.883:
INFO/DEBUG(167): 76475c50  7373df3812-10 23:03:55.883:
INFO/DEBUG(167): 76475c54  715ef02c
/data/data/name.antonsmirnov.android.arduinodroid/lib/libclang_wrapper.so
(Java_name_antonsmirnov_clang_clang_1wrapper_getDiagnostics+76)12-10
23:03:55.883: INFO/DEBUG(167): #01  76475c58  6d707560
/dev/ashmem/dalvik-LinearAlloc (deleted)12-10 23:03:55.883:
INFO/DEBUG(167): 76475c5c  1d30000512-10 23:03:55.883:
INFO/DEBUG(167): 76475c60  1d30000112-10 23:03:55.883:
INFO/DEBUG(167): 76475c64  7308de7812-10 23:03:55.883:
INFO/DEBUG(167): 76475c68  42802618  /dev/ashmem/dalvik-heap
(deleted)12-10 23:03:55.883: INFO/DEBUG(167): 76475c6c  731a51c812-10
23:03:55.883: INFO/DEBUG(167): 76475c70  7160ca7812-10 23:03:55.883:
INFO/DEBUG(167): 76475c74  7160cb2012-10 23:03:55.883:
INFO/DEBUG(167): 76475c78  76475c94  [stack:3690]12-10 23:03:55.883:
INFO/DEBUG(167): 76475c7c  41463b74  /system/lib/libdvm.so
(dvmPlatformInvoke+116)12-10 23:03:55.883: INFO/DEBUG(167): #02
76475c80  7373df2c12-10 23:03:55.883: INFO/DEBUG(167): 76475c84
0000000112-10 23:03:55.883: INFO/DEBUG(167): 76475c88  427fe0c8
/dev/ashmem/dalvik-heap (deleted)12-10 23:03:55.883: INFO/DEBUG(167):
76475c8c  741b6c52
/data/dalvik-cache/data at app@name.antonsmirnov.android.arduinodroid-1.apk at classes.dex12-10
23:03:55.883: INFO/DEBUG(167): 76475c90  0000000012-10 23:03:55.883:
INFO/DEBUG(167): 76475c94  414928bd  /system/lib/libdvm.so
(dvmCallJNIMethod(unsigned int const*, JValue*, Method const*,
Thread*)+364)12-10 23:03:55.893: INFO/DEBUG(167): memory near r0:12-10
23:03:55.893: INFO/DEBUG(167): 76475c00 7373df30 7160ca88 76475c7c
40137ff1  0.ss..`q|\Gv... at 12-10 23:03:55.893: INFO/DEBUG(167):
76475c10 75fcda38 402028ff df0027ad 00000000  8..u.( @.'......12-10
23:03:55.893: INFO/DEBUG(167): 76475c20 1d300005 7308de78 76475c54
715ebdb0  ..0.x..sT\Gv..^q12-10 23:03:55.893: INFO/DEBUG(167):
76475c30 7308de78 715f1620 1d200005 0008de78  x..s ._q.. .x...12-10
23:03:55.893: INFO/DEBUG(167): 76475c40 1d300005 6da271c0 7160ca78
00000004  ..0..q.mx.`q....12-10 23:03:55.893: INFO/DEBUG(167): memory
near r2:12-10 23:03:55.893: INFO/DEBUG(167): 73265708 00000002
7326f158 72d26e70 7324d350  ....X.&spn.rP.$s12-10 23:03:55.893:
INFO/DEBUG(167): 73265718 0000006a 00000000 00000050 00000043
j.......P...C...12-10 23:03:55.893: INFO/DEBUG(167): 73265728 00000001
401000f0 00000000 00000006  ....... at ........12-10 23:03:55.893:
INFO/DEBUG(167): 73265738 0000000a 0000000a 00000008 00000000
................12-10 23:03:55.893: INFO/DEBUG(167): 73265748 00000e60
749a3930 749a3930 00000000  `...09.t09.t....12-10 23:03:55.893:
INFO/DEBUG(167): memory near r4:12-10 23:03:55.893: INFO/DEBUG(167):
735086c0 00790063 00750066 00760079 00000076  c.y.f.u.y.v.v...12-10
23:03:55.893: INFO/DEBUG(167): 735086d0 006a0020 00670062 00000068
0000001b   .j.b.g.h.......12-10 23:03:55.893: INFO/DEBUG(167):
735086e0 75fcda38 00000000 00000000 00000000  8..u............12-10
23:03:55.893: INFO/DEBUG(167): 735086f0 00000000 0000001b 00000001
00000001  ................12-10 23:03:55.893: INFO/DEBUG(167):
73508700 72cfb378 00000000 00000018 000000bb  x..r............12-10
23:03:55.893: INFO/DEBUG(167): memory near r5:12-10 23:03:55.893:
INFO/DEBUG(167): 731a51a8 749a3930 749a3930 749a3930 00000000
09.t09.t09.t....12-10 23:03:55.893: INFO/DEBUG(167): 731a51b8 00000000
00000000 00000000 00000023  ............#...12-10 23:03:55.893:
INFO/DEBUG(167): 731a51c8 715a1dc0 731a3f48 72dbafc0 735086e0
..ZqH?.s...r..Ps12-10 23:03:55.893: INFO/DEBUG(167): 731a51d8 73121220
00000000 00000000 0000001b   ..s............12-10 23:03:55.893:
INFO/DEBUG(167): 731a51e8 00000005 00000005 00000000 6e616c63
............clan12-10 23:03:55.893: INFO/DEBUG(167): memory near
r6:12-10 23:03:55.893: INFO/DEBUG(167): 73265708 00000002 7326f158
72d26e70 7324d350  ....X.&spn.rP.$s12-10 23:03:55.893:
INFO/DEBUG(167): 73265718 0000006a 00000000 00000050 00000043
j.......P...C...12-10 23:03:55.893: INFO/DEBUG(167): 73265728 00000001
401000f0 00000000 00000006  ....... at ........12-10 23:03:55.893:
INFO/DEBUG(167): 73265738 0000000a 0000000a 00000008 00000000
................12-10 23:03:55.893: INFO/DEBUG(167): 73265748 00000e60
749a3930 749a3930 00000000  `...09.t09.t....12-10 23:03:55.893:
INFO/DEBUG(167): memory near r7:12-10 23:03:55.893: INFO/DEBUG(167):
731a3f28 00000001 00000001 70a57cd8 00000000  .........|.p....12-10
23:03:55.893: INFO/DEBUG(167): 731a3f38 732657a8 70a32c28 00000020
000003b3  .W&s(,.p .......12-10 23:03:55.893: INFO/DEBUG(167):
731a3f48 75fcdfc8 731225f0 72d8ddd8 733af500  ...u.%.s...r..:s12-10
23:03:55.893: INFO/DEBUG(167): 731a3f58 715b2ac8 00000000 73043e00
73690600  .*[q.....>.s..is12-10 23:03:55.893: INFO/DEBUG(167):
731a3f68 734d9f88 00000000 00000000 00000000  ..Ms............12-10
23:03:55.893: INFO/DEBUG(167): memory near r8:12-10 23:03:55.893:
INFO/DEBUG(167): 76475c60 1d300001 7308de78 42802618 731a51c8
..0.x..s.&.B.Q.s12-10 23:03:55.893: INFO/DEBUG(167): 76475c70 7160ca78
7160cb20 76475c94 41463b74  x.`q .`q.\Gvt;FA12-10 23:03:55.893:
INFO/DEBUG(167): 76475c80 7373df2c 00000001 427fe0c8 741b6c52
,.ss.......BRl.t12-10 23:03:55.893: INFO/DEBUG(167): 76475c90 00000000
414928bd 7373df2c 741b6c50  .....(IA,.ssPl.t12-10 23:03:55.893:
INFO/DEBUG(167): 76475ca0 715eefe0 7160ca88 00000000 00000000
..^q..`q........12-10 23:03:55.893: INFO/DEBUG(167): memory near
r9:12-10 23:03:55.893: INFO/DEBUG(167): 7373df10 00000000 00000000
7373df48 7417562c  ........H.ss,V.t12-10 23:03:55.893:
INFO/DEBUG(167): 7373df20 6da271c0 00000000 00000000 1d300001
.q.m..........0.12-10 23:03:55.893: INFO/DEBUG(167): 7373df30 1d300005
7373df84 741750a8 6da26b58  ..0...ss.P.tXk.m12-10 23:03:55.893:
INFO/DEBUG(167): 7373df40 7417562c 00000000 6d707560 00000000
,V.t....`upm....12-10 23:03:55.893: INFO/DEBUG(167): 7373df50 00000000
00000000 00000006 1d200005  .............. .12-10 23:03:55.893:
INFO/DEBUG(167): memory near sl:12-10 23:03:55.893: INFO/DEBUG(167):
7160ca68 00000002 00000000 00000010 00000453  ............S...12-10
23:03:55.893: INFO/DEBUG(167): 7160ca78 74175628 7373df2c 6da26b58
70991000  (V.t,.ssXk.m...p12-10 23:03:55.893: INFO/DEBUG(167):
7160ca88 427fded8 00000007 76475da8 00000000  ...B.....]Gv....12-10
23:03:55.893: INFO/DEBUG(167): 7160ca98 76475ddc 00000010 00000000
41463d00  .]Gv.........=FA12-10 23:03:55.893: INFO/DEBUG(167):
7160caa8 00000000 00000000 6ca88670 7373a300  ........p..l..ss12-10
23:03:55.893: INFO/DEBUG(167): memory near fp:12-10 23:03:55.893:
INFO/DEBUG(167): 76475c5c 1d300005 1d300001 7308de78 42802618
..0...0.x..s.&.B12-10 23:03:55.893: INFO/DEBUG(167): 76475c6c 731a51c8
7160ca78 7160cb20 76475c94  .Q.sx.`q .`q.\Gv12-10 23:03:55.893:
INFO/DEBUG(167): 76475c7c 41463b74 7373df2c 00000001 427fe0c8
t;FA,.ss.......B12-10 23:03:55.893: INFO/DEBUG(167): 76475c8c 741b6c52
00000000 414928bd 7373df2c  Rl.t.....(IA,.ss12-10 23:03:55.893:
INFO/DEBUG(167): 76475c9c 741b6c50 715eefe0 7160ca88 00000000
Pl.t..^q..`q....12-10 23:03:55.893: INFO/DEBUG(167): memory near
sp:12-10 23:03:55.893: INFO/DEBUG(167): 76475c00 7373df30 7160ca88
76475c7c 40137ff1  0.ss..`q|\Gv... at 12-10 23:03:55.893:
INFO/DEBUG(167): 76475c10 75fcda38 402028ff df0027ad 00000000  8..u.(
@.'......12-10 23:03:55.893: INFO/DEBUG(167): 76475c20 1d300005
7308de78 76475c54 715ebdb0  ..0.x..sT\Gv..^q12-10 23:03:55.893:
INFO/DEBUG(167): 76475c30 7308de78 715f1620 1d200005 0008de78  x..s
._q.. .x...12-10 23:03:55.893: INFO/DEBUG(167): 76475c40 1d300005
6da271c0 7160ca78 00000004  ..0..q.mx.`q....12-10 23:03:55.893:
INFO/DEBUG(167): code around pc:12-10 23:03:55.893: INFO/DEBUG(167):
7537b178 ebff8235 e3560000 15963000 e1a0000d  5.....V..0......12-10
23:03:55.893: INFO/DEBUG(167): 7537b188 e1a02006 12833001 15863000
e5973020  . ...0...0.. 0..12-10 23:03:55.893: INFO/DEBUG(167):
7537b198 e5931408 eb0152d7 e59f305c e58d4018  .....R..\0... at ..12-10
23:03:55.893: INFO/DEBUG(167): 7537b1a8 e58d401c e08f3003 e2833008
e597412c  . at ...0...0..,A..12-10 23:03:55.893: INFO/DEBUG(167):
7537b1b8 e58d3000 e5977130 ea000002 e1a01004  .0..0q..........12-10
23:03:55.893: INFO/DEBUG(167): code around lr:12-10 23:03:55.893:
INFO/DEBUG(167): 7537b15c e8800048 e580600c e5c06010 e585000c
H....`...`......12-10 23:03:55.893: INFO/DEBUG(167): 7537b16c e3a00038
ebff779f e1a06000 ebff8235  8....w...`..5...12-10 23:03:55.893:
INFO/DEBUG(167): 7537b17c e3560000 15963000 e1a0000d e1a02006
..V..0....... ..12-10 23:03:55.893: INFO/DEBUG(167): 7537b18c 12833001
15863000 e5973020 e5931408  .0...0.. 0......12-10 23:03:55.893:
INFO/DEBUG(167): 7537b19c eb0152d7 e59f305c e58d4018 e58d401c
.R..\0... at ...@..12-10 23:03:55.923: DEBUG/WifiStateMachine(539):
ConnectedState{ what=131155 when=-4ms arg1=1 }12-10 23:03:55.933:
DEBUG/WifiStateMachine(539): L2ConnectedState{ what=131155 when=-4ms
arg1=1 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131210/92c336bc/attachment.html>


More information about the cfe-dev mailing list