OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" | 7 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" |
8 | 8 |
9 #include "chrome/app/breakpad_linux.h" | 9 #include "chrome/app/breakpad_linux.h" |
10 | 10 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 639 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
640 new google_breakpad::ExceptionHandler(dumps_path.value().c_str(), NULL, | 640 new google_breakpad::ExceptionHandler(dumps_path.value().c_str(), NULL, |
641 CrashDoneNoUpload, NULL, | 641 CrashDoneNoUpload, NULL, |
642 true /* install handlers */); | 642 true /* install handlers */); |
643 } else { | 643 } else { |
644 new google_breakpad::ExceptionHandler("/tmp", NULL, CrashDoneUpload, NULL, | 644 new google_breakpad::ExceptionHandler("/tmp", NULL, CrashDoneUpload, NULL, |
645 true /* install handlers */); | 645 true /* install handlers */); |
646 } | 646 } |
647 } | 647 } |
648 | 648 |
649 // Currently Non-Browser = Renderer, Plugins and Native Client | 649 // Currently Non-Browser = Renderer, Plugins, Native Client and Gpu |
650 static bool | 650 static bool |
651 NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size, | 651 NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size, |
652 void* context) { | 652 void* context) { |
653 const int fd = reinterpret_cast<intptr_t>(context); | 653 const int fd = reinterpret_cast<intptr_t>(context); |
654 int fds[2] = { -1, -1 }; | 654 int fds[2] = { -1, -1 }; |
655 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { | 655 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { |
656 static const char msg[] = "Failed to create socket for crash dumping.\n"; | 656 static const char msg[] = "Failed to create socket for crash dumping.\n"; |
657 sys_write(2, msg, sizeof(msg)-1); | 657 sys_write(2, msg, sizeof(msg)-1); |
658 return false; | 658 return false; |
659 } | 659 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 void InitCrashReporter() { | 741 void InitCrashReporter() { |
742 // Determine the process type and take appropriate action. | 742 // Determine the process type and take appropriate action. |
743 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 743 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
744 const std::string process_type = | 744 const std::string process_type = |
745 parsed_command_line.GetSwitchValueASCII(switches::kProcessType); | 745 parsed_command_line.GetSwitchValueASCII(switches::kProcessType); |
746 if (process_type.empty()) { | 746 if (process_type.empty()) { |
747 EnableCrashDumping(getenv(env_vars::kHeadless) != NULL); | 747 EnableCrashDumping(getenv(env_vars::kHeadless) != NULL); |
748 } else if (process_type == switches::kRendererProcess || | 748 } else if (process_type == switches::kRendererProcess || |
749 process_type == switches::kPluginProcess || | 749 process_type == switches::kPluginProcess || |
750 process_type == switches::kZygoteProcess || | 750 process_type == switches::kZygoteProcess || |
751 process_type == switches::kNaClLoaderProcess) { | 751 process_type == switches::kNaClLoaderProcess || |
| 752 process_type == switches::kGpuProcess) { |
752 // We might be chrooted in a zygote or renderer process so we cannot call | 753 // We might be chrooted in a zygote or renderer process so we cannot call |
753 // GetCollectStatsConsent because that needs access the the user's home | 754 // GetCollectStatsConsent because that needs access the the user's home |
754 // dir. Instead, we set a command line flag for these processes. | 755 // dir. Instead, we set a command line flag for these processes. |
755 // Even though plugins are not chrooted, we share the same code path for | 756 // Even though plugins are not chrooted, we share the same code path for |
756 // simplicity. | 757 // simplicity. |
757 if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter)) | 758 if (!parsed_command_line.HasSwitch(switches::kEnableCrashReporter)) |
758 return; | 759 return; |
759 // Get the guid and linux distro from the command line switch. | 760 // Get the guid and linux distro from the command line switch. |
760 std::string switch_value = | 761 std::string switch_value = |
761 parsed_command_line.GetSwitchValueASCII(switches::kEnableCrashReporter); | 762 parsed_command_line.GetSwitchValueASCII(switches::kEnableCrashReporter); |
(...skipping 11 matching lines...) Expand all Loading... |
773 struct timeval tv; | 774 struct timeval tv; |
774 if (!gettimeofday(&tv, NULL)) | 775 if (!gettimeofday(&tv, NULL)) |
775 process_start_time = timeval_to_ms(&tv); | 776 process_start_time = timeval_to_ms(&tv); |
776 else | 777 else |
777 process_start_time = 0; | 778 process_start_time = 0; |
778 } | 779 } |
779 | 780 |
780 bool IsCrashReporterEnabled() { | 781 bool IsCrashReporterEnabled() { |
781 return is_crash_reporter_enabled; | 782 return is_crash_reporter_enabled; |
782 } | 783 } |
OLD | NEW |