Loading debuggerd/crash_dump.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,12 @@ static bool tombstoned_notify_completion(int tombstoned_socket) { return true; } static void signal_handler(int) { // We can't log easily, because the heap might be corrupt. // Just die and let the surrounding log context explain things. _exit(1); } static void abort_handler(pid_t target, const bool& tombstoned_connected, unique_fd& tombstoned_socket, unique_fd& output_fd, const char* abort_msg) { Loading @@ -175,7 +181,6 @@ static void abort_handler(pid_t target, const bool& tombstoned_connected, dprintf(output_fd.get(), "crash_dump failed to dump process %d: %s\n", target, abort_msg); // Don't dump ourselves. _exit(1); } Loading @@ -201,6 +206,11 @@ int main(int argc, char** argv) { abort_handler(target, tombstoned_connected, tombstoned_socket, output_fd, abort_msg); }); // Don't try to dump ourselves. struct sigaction action = {}; action.sa_handler = signal_handler; debuggerd_register_handlers(&action); if (argc != 2) { return 1; } Loading debuggerd/handler/debuggerd_handler.cpp +1 −11 Original line number Diff line number Diff line Loading @@ -367,15 +367,5 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks) { // Use the alternate signal stack if available so we can catch stack overflows. action.sa_flags |= SA_ONSTACK; sigaction(SIGABRT, &action, nullptr); sigaction(SIGBUS, &action, nullptr); sigaction(SIGFPE, &action, nullptr); sigaction(SIGILL, &action, nullptr); sigaction(SIGSEGV, &action, nullptr); #if defined(SIGSTKFLT) sigaction(SIGSTKFLT, &action, nullptr); #endif sigaction(SIGTRAP, &action, nullptr); sigaction(DEBUGGER_SIGNAL, &action, nullptr); debuggerd_register_handlers(&action); } debuggerd/include/debuggerd/handler.h +13 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,17 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks); // to the log. #define DEBUGGER_SIGNAL (__SIGRTMIN + 3) static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigaction* action) { sigaction(SIGABRT, action, nullptr); sigaction(SIGBUS, action, nullptr); sigaction(SIGFPE, action, nullptr); sigaction(SIGILL, action, nullptr); sigaction(SIGSEGV, action, nullptr); #if defined(SIGSTKFLT) sigaction(SIGSTKFLT, action, nullptr); #endif sigaction(SIGTRAP, action, nullptr); sigaction(DEBUGGER_SIGNAL, action, nullptr); } __END_DECLS Loading
debuggerd/crash_dump.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,12 @@ static bool tombstoned_notify_completion(int tombstoned_socket) { return true; } static void signal_handler(int) { // We can't log easily, because the heap might be corrupt. // Just die and let the surrounding log context explain things. _exit(1); } static void abort_handler(pid_t target, const bool& tombstoned_connected, unique_fd& tombstoned_socket, unique_fd& output_fd, const char* abort_msg) { Loading @@ -175,7 +181,6 @@ static void abort_handler(pid_t target, const bool& tombstoned_connected, dprintf(output_fd.get(), "crash_dump failed to dump process %d: %s\n", target, abort_msg); // Don't dump ourselves. _exit(1); } Loading @@ -201,6 +206,11 @@ int main(int argc, char** argv) { abort_handler(target, tombstoned_connected, tombstoned_socket, output_fd, abort_msg); }); // Don't try to dump ourselves. struct sigaction action = {}; action.sa_handler = signal_handler; debuggerd_register_handlers(&action); if (argc != 2) { return 1; } Loading
debuggerd/handler/debuggerd_handler.cpp +1 −11 Original line number Diff line number Diff line Loading @@ -367,15 +367,5 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks) { // Use the alternate signal stack if available so we can catch stack overflows. action.sa_flags |= SA_ONSTACK; sigaction(SIGABRT, &action, nullptr); sigaction(SIGBUS, &action, nullptr); sigaction(SIGFPE, &action, nullptr); sigaction(SIGILL, &action, nullptr); sigaction(SIGSEGV, &action, nullptr); #if defined(SIGSTKFLT) sigaction(SIGSTKFLT, &action, nullptr); #endif sigaction(SIGTRAP, &action, nullptr); sigaction(DEBUGGER_SIGNAL, &action, nullptr); debuggerd_register_handlers(&action); }
debuggerd/include/debuggerd/handler.h +13 −0 Original line number Diff line number Diff line Loading @@ -39,4 +39,17 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks); // to the log. #define DEBUGGER_SIGNAL (__SIGRTMIN + 3) static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigaction* action) { sigaction(SIGABRT, action, nullptr); sigaction(SIGBUS, action, nullptr); sigaction(SIGFPE, action, nullptr); sigaction(SIGILL, action, nullptr); sigaction(SIGSEGV, action, nullptr); #if defined(SIGSTKFLT) sigaction(SIGSTKFLT, action, nullptr); #endif sigaction(SIGTRAP, action, nullptr); sigaction(DEBUGGER_SIGNAL, action, nullptr); } __END_DECLS