| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/breakpad/browser/crash_handler_host_linux.h" | 5 #include "components/crash/browser/crash_handler_host_linux.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
| 11 #include <unistd.h> | 11 #include <unistd.h> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/files/scoped_file.h" | 17 #include "base/files/scoped_file.h" |
| 18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
| 19 #include "base/linux_util.h" | 19 #include "base/linux_util.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
| 22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 23 #include "base/posix/eintr_wrapper.h" | 23 #include "base/posix/eintr_wrapper.h" |
| 24 #include "base/rand_util.h" | 24 #include "base/rand_util.h" |
| 25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 27 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
| 28 #include "breakpad/src/client/linux/handler/exception_handler.h" | 28 #include "breakpad/src/client/linux/handler/exception_handler.h" |
| 29 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" | 29 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" |
| 30 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" | 30 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" |
| 31 #include "components/breakpad/app/breakpad_linux_impl.h" | 31 #include "components/crash/app/breakpad_linux_impl.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 | 33 |
| 34 #if defined(OS_ANDROID) && !defined(__LP64__) | 34 #if defined(OS_ANDROID) && !defined(__LP64__) |
| 35 #include <sys/linux-syscalls.h> | 35 #include <sys/linux-syscalls.h> |
| 36 | 36 |
| 37 #define SYS_read __NR_read | 37 #define SYS_read __NR_read |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 using content::BrowserThread; | 40 using content::BrowserThread; |
| 41 using google_breakpad::ExceptionHandler; | 41 using google_breakpad::ExceptionHandler; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { | 136 void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { |
| 137 DCHECK_EQ(browser_socket_, fd); | 137 DCHECK_EQ(browser_socket_, fd); |
| 138 | 138 |
| 139 // A process has crashed and has signaled us by writing a datagram | 139 // A process has crashed and has signaled us by writing a datagram |
| 140 // to the death signal socket. The datagram contains the crash context needed | 140 // to the death signal socket. The datagram contains the crash context needed |
| 141 // for writing the minidump as well as a file descriptor and a credentials | 141 // for writing the minidump as well as a file descriptor and a credentials |
| 142 // block so that they can't lie about their pid. | 142 // block so that they can't lie about their pid. |
| 143 // | 143 // |
| 144 // The message sender is in components/breakpad/app/breakpad_linux.cc. | 144 // The message sender is in components/crash/app/breakpad_linux.cc. |
| 145 | 145 |
| 146 struct msghdr msg = {0}; | 146 struct msghdr msg = {0}; |
| 147 struct iovec iov[kCrashIovSize]; | 147 struct iovec iov[kCrashIovSize]; |
| 148 | 148 |
| 149 scoped_ptr<char[]> crash_context(new char[kCrashContextSize]); | 149 scoped_ptr<char[]> crash_context(new char[kCrashContextSize]); |
| 150 #if defined(ADDRESS_SANITIZER) | 150 #if defined(ADDRESS_SANITIZER) |
| 151 scoped_ptr<char[]> asan_report(new char[kMaxAsanReportSize + 1]); | 151 scoped_ptr<char[]> asan_report(new char[kMaxAsanReportSize + 1]); |
| 152 #endif | 152 #endif |
| 153 | 153 |
| 154 scoped_ptr<CrashKeyStorage> crash_keys(new CrashKeyStorage); | 154 scoped_ptr<CrashKeyStorage> crash_keys(new CrashKeyStorage); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // no-ops. | 427 // no-ops. |
| 428 shutting_down_ = true; | 428 shutting_down_ = true; |
| 429 uploader_thread_->Stop(); | 429 uploader_thread_->Stop(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 bool CrashHandlerHostLinux::IsShuttingDown() const { | 432 bool CrashHandlerHostLinux::IsShuttingDown() const { |
| 433 return shutting_down_; | 433 return shutting_down_; |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace breakpad | 436 } // namespace breakpad |
| OLD | NEW |