| 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/crash/browser/crash_handler_host_linux.h" | 5 #include "components/crash/content/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/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.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/location.h" | 20 #include "base/location.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.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/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
| 26 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 27 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
| 28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
| 29 #include "breakpad/src/client/linux/handler/exception_handler.h" | 29 #include "breakpad/src/client/linux/handler/exception_handler.h" |
| 30 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" | 30 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" |
| 31 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" | 31 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" |
| 32 #include "components/crash/app/breakpad_linux_impl.h" | 32 #include "components/crash/content/app/breakpad_linux_impl.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 | 34 |
| 35 #if defined(OS_ANDROID) && !defined(__LP64__) | 35 #if defined(OS_ANDROID) && !defined(__LP64__) |
| 36 #include <sys/linux-syscalls.h> | 36 #include <sys/linux-syscalls.h> |
| 37 | 37 |
| 38 #define SYS_read __NR_read | 38 #define SYS_read __NR_read |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 using content::BrowserThread; | 41 using content::BrowserThread; |
| 42 using google_breakpad::ExceptionHandler; | 42 using google_breakpad::ExceptionHandler; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { | 137 void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { |
| 138 DCHECK_EQ(browser_socket_, fd); | 138 DCHECK_EQ(browser_socket_, fd); |
| 139 | 139 |
| 140 // A process has crashed and has signaled us by writing a datagram | 140 // A process has crashed and has signaled us by writing a datagram |
| 141 // to the death signal socket. The datagram contains the crash context needed | 141 // to the death signal socket. The datagram contains the crash context needed |
| 142 // for writing the minidump as well as a file descriptor and a credentials | 142 // for writing the minidump as well as a file descriptor and a credentials |
| 143 // block so that they can't lie about their pid. | 143 // block so that they can't lie about their pid. |
| 144 // | 144 // |
| 145 // The message sender is in components/crash/app/breakpad_linux.cc. | 145 // The message sender is in components/crash/content/app/breakpad_linux.cc. |
| 146 | 146 |
| 147 struct msghdr msg = {0}; | 147 struct msghdr msg = {0}; |
| 148 struct iovec iov[kCrashIovSize]; | 148 struct iovec iov[kCrashIovSize]; |
| 149 | 149 |
| 150 scoped_ptr<char[]> crash_context(new char[kCrashContextSize]); | 150 scoped_ptr<char[]> crash_context(new char[kCrashContextSize]); |
| 151 #if defined(ADDRESS_SANITIZER) | 151 #if defined(ADDRESS_SANITIZER) |
| 152 scoped_ptr<char[]> asan_report(new char[kMaxAsanReportSize + 1]); | 152 scoped_ptr<char[]> asan_report(new char[kMaxAsanReportSize + 1]); |
| 153 #endif | 153 #endif |
| 154 | 154 |
| 155 scoped_ptr<CrashKeyStorage> crash_keys(new CrashKeyStorage); | 155 scoped_ptr<CrashKeyStorage> crash_keys(new CrashKeyStorage); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 // no-ops. | 428 // no-ops. |
| 429 shutting_down_ = true; | 429 shutting_down_ = true; |
| 430 uploader_thread_->Stop(); | 430 uploader_thread_->Stop(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 bool CrashHandlerHostLinux::IsShuttingDown() const { | 433 bool CrashHandlerHostLinux::IsShuttingDown() const { |
| 434 return shutting_down_; | 434 return shutting_down_; |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace breakpad | 437 } // namespace breakpad |
| OLD | NEW |