Android (client and API): stack trace voodoo causes crashes on some devices; disable by default.

This commit is contained in:
David Anderson 2017-04-12 15:48:09 -07:00
parent e30ccaa334
commit 6dc6615154
2 changed files with 16 additions and 11 deletions

View File

@ -61,7 +61,7 @@
#include "diagnostics.h"
#ifdef ANDROID
#ifdef ANDROID_VOODOO
// for signal handler backtrace
unwind_backtrace_signal_arch_t unwind_backtrace_signal_arch;
acquire_my_map_info_list_t acquire_my_map_info_list;
@ -103,7 +103,7 @@ static double max_stderr_file_size = 2048*1024;
static double stdout_file_size = 0;
static double max_stdout_file_size = 2048*1024;
#ifdef ANDROID
#ifdef ANDROID_VOODOO
static void* libhandle;
#endif
@ -408,7 +408,7 @@ int diagnostics_init(
#endif // defined(_WIN32)
#ifdef ANDROID
#ifdef ANDROID_VOODOO
#define resolve_func(l,x) \
x=(x##_t)dlsym(l,#x); \
if (!x) {\
@ -429,7 +429,7 @@ int diagnostics_init(
} else {
fprintf(stderr,"stackdumps unavailable\n");
}
#endif // ANDROID
#endif // ANDROID_VOODOO
// Install unhandled exception filters and signal traps.
if (BOINC_SUCCESS != boinc_install_signal_handlers()) {
@ -566,7 +566,7 @@ int diagnostics_finish() {
#endif // defined(_DEBUG)
#endif // defined(_WIN32)
#ifdef ANDROID
#ifdef ANDROID_VOODOO
if (libhandle) {
dlclose(libhandle);
}
@ -729,7 +729,7 @@ void set_signal_exit_code(int x) {
signal_exit_code = x;
}
#ifdef ANDROID
#ifdef ANDROID_VOODOO
const char *argv0;
static char *xtoa(size_t x) {
@ -750,7 +750,7 @@ static char *xtoa(size_t x) {
#endif
#ifdef HAVE_SIGACTION
#ifdef ANDROID
#ifdef ANDROID_VOODOO
void boinc_catch_signal(int signal, struct siginfo *siginfo, void *sigcontext) {
#else
void boinc_catch_signal(int signal, struct siginfo *, void *) {
@ -801,7 +801,7 @@ void boinc_catch_signal(int signal) {
PrintBacktrace();
#endif
#ifdef ANDROID
#ifdef ANDROID_VOODOO
// this is some dark undocumented Android voodoo that uses libcorkscrew.so.
// Minimal use of library functions because they may not work in a signal
// handler.
@ -867,7 +867,7 @@ void boinc_catch_signal(int signal) {
fflush(stderr);
}
}
#endif // ANDROID
#endif // ANDROID_VOODOO
fprintf(stderr, "\nExiting...\n");
_exit(signal_exit_code);

View File

@ -34,6 +34,11 @@
#include <dlfcn.h>
#endif
// some of the Android stuff below causes seg faults on some devices.
// Disable by default.
// Set this to enable it.
//
//#define ANDROID_VOODOO
// flags for boinc_init_diagnostics()
//
@ -146,7 +151,7 @@ extern void set_signal_exit_code(int);
}
#endif
#ifdef ANDROID
#ifdef ANDROID_VOODOO
// Yes, these are undocumented android functions located
// libcorkscrew.so . They may not always be there, but it's better than
// nothing. And we've got source so we could reimplement them if necessary.
@ -213,7 +218,7 @@ extern find_symbol_t find_symbol;
typedef void (* format_backtrace_line_t)(unsigned, const backtrace_frame_t *, const backtrace_symbol_t *, char *, size_t);
extern format_backtrace_line_t format_backtrace_line;
#endif // ANDROID
#endif // ANDROID_VOODOO
#ifdef _WIN32