Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try to handle crash signals (SIGSEGV etc.) and send kill to yourself in signal handler. This trick helps me.</p> <p>Example:</p> <pre><code>#include &lt;signal.h&gt; #include &lt;unistd.h&gt; static void signal_handler(int signal, siginfo_t *info, void *reserved) { kill(getpid(),SIGKILL); } extern "C" jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/) { struct sigaction handler; memset(&amp;handler, 0, sizeof(handler)); handler.sa_sigaction = signal_handler; handler.sa_flags = SA_SIGINFO; sigaction(SIGILL, &amp;handler, NULL); sigaction(SIGABRT, &amp;handler, NULL); sigaction(SIGBUS, &amp;handler, NULL); sigaction(SIGFPE, &amp;handler, NULL); sigaction(SIGSEGV, &amp;handler, NULL); sigaction(SIGSTKFLT, &amp;handler, NULL); return(JNI_VERSION_1_6); } </code></pre> <p><strong>UPDATE2</strong></p> <p>if you want to see crashlog in android logcat you should use this signal handler</p> <pre><code>static void signal_handler(int signal, siginfo_t *info, void *reserved) { struct sockaddr_un addr; size_t namelen; socklen_t alen; int s, err; char name[] = "android:debuggerd"; namelen = strlen(name); // Test with length +1 for the *initial* '\0'. if ((namelen + 1) &gt; sizeof(addr.sun_path)) { errno = EINVAL; return; } /* This is used for abstract socket namespace, we need * an initial '\0' at the start of the Unix socket path. * * Note: The path in this case is *not* supposed to be * '\0'-terminated. ("man 7 unix" for the gory details.) */ memset (&amp;addr, 0, sizeof addr); addr.sun_family = AF_LOCAL; addr.sun_path[0] = 0; memcpy(addr.sun_path + 1, name, namelen); alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1; s = socket(AF_LOCAL, SOCK_STREAM, 0); if(s &lt; 0) return; RETRY_ON_EINTR(err,connect(s, (struct sockaddr *) &amp;addr, alen)); if (err &lt; 0) { close(s); s = -1; } pid_t tid = gettid(); if(s&gt;=0) { /* debugger knows our pid from the credentials on the * local socket but we need to tell it our tid. It * is paranoid and will verify that we are giving a tid * that's actually in our process */ int ret; RETRY_ON_EINTR(ret, write(s, &amp;tid, sizeof(unsigned))); if (ret == sizeof(unsigned)) { /* if the write failed, there is no point to read on * the file descriptor. */ RETRY_ON_EINTR(ret, read(s, &amp;tid, 1)); //notify_gdb_of_libraries(); } close(s); } wait(NULL); kill(getpid(),SIGKILL); } </code></pre> <p>I took it from android source (can't insert link because android.git.kernel.org is down), but I am not sure that it will work in future Android releases</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload