diff options
author | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-04-03 16:38:53 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-04-03 16:38:53 +0000 |
commit | 4f291f0307ae6f33f70f578cbcd4450923692412 (patch) | |
tree | bd671ae6f9fcf46d1764c2deae9d691325bbbe62 /src/client/linux/handler | |
parent | Remove redundant include of CPP specific header files (diff) | |
download | breakpad-4f291f0307ae6f33f70f578cbcd4450923692412.tar.xz |
Changes to get the breakpad client compiling and running on Android using
ndk-7b.
Patch by Carlos Valdivia <carlosvaldivia@google.com>
Review URL: https://breakpad.appspot.com/363001/
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@945 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/handler')
-rw-r--r-- | src/client/linux/handler/exception_handler.cc | 31 |
1 files changed, 19 insertions, 12 deletions
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); } } |