My app uses native code, and I install my custom signal handler to
handle crashes. When it is called, it launches a separate crash-
reporting process (the activity specifies android:process for process
isolation) which will report the crash details in logcat after waiting
for a bit (to ensure the crash details get written). My custom signal
handler then dispatches to the original signal handler which usually
writes the native crash details to logcat. However, sometimes the
default signal handler does not write the crash details and instead
just seems to return. I know it was called and that it returns because
I have a log message in my custom crash handler before and after the
call to the default crash handler.

If I reset the handler to the original handler, and trigger another
crash from my custom handler, the crash details do get written to
logcat, but it does not have the stack of the original crash, and so
its not of much value. However, it confirms that the value of
original_handler does point to the original handler.

Any idea why the call to the default crash handler may not write the
crash details to logcat? Could it be that the bit which indicates that
the process has crashed gets reset sometimes?

This is the pseudo-code:

signalhandler original_handler;

void my_custom_handler(int sig) {
 
launch_separate_process_to_report_logcat_after_waiting_for_one_second();
  LOG("Calling original handler");

  // This normally writes crash details to logcat and then terminates
the app
  // Sometimes it does not write the crash details to logcat and just
returns
  original_handler(sig);

  LOG("Called original handler");
}

void setup_crash_handling() {
  original_handler = signal(my_custom_handler, SIGSEGV);
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to