Crash reason (Java-JNI-Clang C API)?

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-11 00:10:38.126: INFO/DEBUG(166): backtrace:
12-11 00:10:38.126: INFO/DEBUG(166): #00 pc 0001832a /system/lib/libc.so
12-11 00:10:38.126: INFO/DEBUG(166): #01 pc 0000dc04 /system/lib/libc.so (abort+4)
12-11 00:10:38.126: INFO/DEBUG(166): #02 pc 0001f0df /system/lib/libc.so (__assert2+30)
12-11 00:10:38.126: INFO/DEBUG(166): #03 pc 0077c954 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::getSourceLocation(char const*, unsigned int) const+76)
12-11 00:10:38.126: INFO/DEBUG(166): #04 pc 0077ca4c /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::FormTokenWithChars(clang::Token&, char const*, clang::tok::TokenKind)+100)
12-11 00:10:38.126: INFO/DEBUG(166): #05 pc 00781098 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::LexTokenInternal(clang::Token&)+5616)
12-11 00:10:38.126: INFO/DEBUG(166): #06 pc 0015de68 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::LexFromRawLexer(clang::Token&)+116)
12-11 00:10:38.126: INFO/DEBUG(166): #07 pc 00781d3c /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::getRawToken(clang::SourceLocation, clang::Token&, clang::SourceManager const&, clang::LangOptions const&)+220)
12-11 00:10:38.126: INFO/DEBUG(166): #08 pc 00781d9c /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::Lexer::MeasureTokenLength(clang::SourceLocation, clang::SourceManager const&, clang::LangOptions const&)+36)
12-11 00:10:38.126: INFO/DEBUG(166): #09 pc 001d1824 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::DiagnosticRenderer::emitMacroExpansions(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const&, unsigned int&, unsigned int)+840)
12-11 00:10:38.126: INFO/DEBUG(166): #10 pc 001d13ec /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::DiagnosticRenderer::emitDiagnostic(clang::SourceLocation, clang::DiagnosticsEngine::Level, llvm::StringRef, llvm::ArrayRefclang::CharSourceRange, llvm::ArrayRefclang::FixItHint, clang::SourceManager const*, llvm::PointerUnion<clang::Diagnostic const*, clang::StoredDiagnostic const*>)+1224)
12-11 00:10:38.126: INFO/DEBUG(166): #11 pc 001d1b20 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::DiagnosticRenderer::emitStoredDiagnostic(clang::StoredDiagnostic&)+304)
12-11 00:10:38.126: INFO/DEBUG(166): #12 pc 0017b1c8 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang.so (clang::cxdiag::lazyCreateDiags(CXTranslationUnitImpl*, bool)+248)
12-11 00:10:38.126: INFO/DEBUG(166): #13 pc 00009028 /data/data/name.antonsmirnov.android.arduinodroid/lib/libclang_wrapper.so (Java_name_antonsmirnov_clang_clang_1wrapper_getDiagnostics+72)
12-11 00:10:38.126: INFO/DEBUG(166): #14 pc 0001fb70 /system/lib/libdvm.so (dvmPlatformInvoke+112)
12-11 00:10:38.126: INFO/DEBUG(166): #15 pc 0004e8b9 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+360)
12-11 00:10:38.126: INFO/DEBUG(166): #16 pc 00029020 /system/lib/libdvm.so
12-11 00:10:38.126: INFO/DEBUG(166): #17 pc 0002d7e8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
12-11 00:10:38.126: INFO/DEBUG(166): #18 pc 0005fed5 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
12-11 00:10:38.126: INFO/DEBUG(166): #19 pc 0005feff /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, …)+20)
12-11 00:10:38.126: INFO/DEBUG(166): #20 pc 00055327 /system/lib/libdvm.so
12-11 00:10:38.126: INFO/DEBUG(166): #21 pc 00012e70 /system/lib/libc.so (__thread_entry+48)
12-11 00:10:38.126: INFO/DEBUG(166): #22 pc 000125c8 /system/lib/libc.so (pthread_create+172)

clang_toggleCrashRecovery does not help and it crashes anyway.

Regards, Anton.