From 4f291f0307ae6f33f70f578cbcd4450923692412 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 3 Apr 2012 16:38:53 +0000 Subject: Changes to get the breakpad client compiling and running on Android using ndk-7b. Patch by Carlos Valdivia Review URL: https://breakpad.appspot.com/363001/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@945 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/handler/exception_handler.cc | 31 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/client/linux/handler') diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc index fff2d1c6..5d9e93f7 100644 --- a/src/client/linux/handler/exception_handler.cc +++ b/src/client/linux/handler/exception_handler.cc @@ -90,6 +90,7 @@ #include "common/linux/linux_libc_support.h" #include "common/memory.h" +#include "client/linux/log/log.h" #include "client/linux/minidump_writer/linux_dumper.h" #include "client/linux/minidump_writer/minidump_writer.h" #include "common/linux/guid_creator.h" @@ -391,14 +392,20 @@ bool ExceptionHandler::GenerateDump(CrashContext *context) { // is the write() and read() calls will fail with EBADF static const char no_pipe_msg[] = "ExceptionHandler::GenerateDump \ sys_pipe failed:"; - sys_write(2, no_pipe_msg, sizeof(no_pipe_msg) - 1); - sys_write(2, strerror(errno), strlen(strerror(errno))); - sys_write(2, "\n", 1); + logger::write(no_pipe_msg, sizeof(no_pipe_msg) - 1); + logger::write(strerror(errno), strlen(strerror(errno))); + logger::write("\n", 1); } +#if defined(__ANDROID__) + const pid_t child = clone( + ThreadEntry, stack, CLONE_FILES | CLONE_FS | CLONE_UNTRACED, + &thread_arg); +#else const pid_t child = sys_clone( ThreadEntry, stack, CLONE_FILES | CLONE_FS | CLONE_UNTRACED, &thread_arg, NULL, NULL, NULL); +#endif int r, status; // Allow the child to ptrace us sys_prctl(PR_SET_PTRACER, child); @@ -412,9 +419,9 @@ bool ExceptionHandler::GenerateDump(CrashContext *context) { if (r == -1) { static const char msg[] = "ExceptionHandler::GenerateDump waitpid failed:"; - sys_write(2, msg, sizeof(msg) - 1); - sys_write(2, strerror(errno), strlen(strerror(errno))); - sys_write(2, "\n", 1); + logger::write(msg, sizeof(msg) - 1); + logger::write(strerror(errno), strlen(strerror(errno))); + logger::write("\n", 1); } bool success = r != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0; @@ -434,9 +441,9 @@ void ExceptionHandler::SendContinueSignalToChild() { if(r == -1) { static const char msg[] = "ExceptionHandler::SendContinueSignalToChild \ sys_write failed:"; - sys_write(2, msg, sizeof(msg) - 1); - sys_write(2, strerror(errno), strlen(strerror(errno))); - sys_write(2, "\n", 1); + logger::write(msg, sizeof(msg) - 1); + logger::write(strerror(errno), strlen(strerror(errno))); + logger::write("\n", 1); } } @@ -449,9 +456,9 @@ void ExceptionHandler::WaitForContinueSignal() { if(r == -1) { static const char msg[] = "ExceptionHandler::WaitForContinueSignal \ sys_read failed:"; - sys_write(2, msg, sizeof(msg) - 1); - sys_write(2, strerror(errno), strlen(strerror(errno))); - sys_write(2, "\n", 1); + logger::write(msg, sizeof(msg) - 1); + logger::write(strerror(errno), strlen(strerror(errno))); + logger::write("\n", 1); } } -- cgit v1.2.1