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 // 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 | 7 |
8 #include "components/crash/app/breakpad_linux.h" | 8 #include "components/crash/app/breakpad_linux.h" |
9 | 9 |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (!succeeded) { | 707 if (!succeeded) { |
708 static const char msg[] = "Microdump crash handler failed.\n"; | 708 static const char msg[] = "Microdump crash handler failed.\n"; |
709 WriteLog(msg, sizeof(msg) - 1); | 709 WriteLog(msg, sizeof(msg) - 1); |
710 return false; | 710 return false; |
711 } | 711 } |
712 | 712 |
713 const bool is_browser_process = (context != NULL); | 713 const bool is_browser_process = (context != NULL); |
714 return FinalizeCrashDoneAndroid(is_browser_process); | 714 return FinalizeCrashDoneAndroid(is_browser_process); |
715 } | 715 } |
716 | 716 |
717 // When unwind tables are stripped out (to save binary size) the stack traces | |
718 // produced locally in the case of a crash / CHECK are meaningless. In order to | |
719 // provide meaningful development diagnostics (and keep the binary size savings) | |
720 // on Android we attach a secondary crash handler, in addition to the breakpad | |
721 // minidump uploader (which depends on the user consent). | |
722 // The microdump handler does NOT upload anything. It just dumps out on the | 717 // The microdump handler does NOT upload anything. It just dumps out on the |
723 // system console (logcat) a restricted and serialized variant of a minidump. | 718 // system console (logcat) a restricted and serialized variant of a minidump. |
724 // See crbug.com/410294 for more details. | 719 // See crbug.com/410294 for more details. |
725 void InitMicrodumpCrashHandlerIfNecessary(const std::string& process_type) { | 720 void InitMicrodumpCrashHandlerIfNecessary(const std::string& process_type) { |
726 #if !defined(NO_UNWIND_TABLES) \ | 721 #if (!defined(ARCH_CPU_ARMEL) && !defined(ARCH_CPU_ARM64)) |
727 || (!defined(ARCH_CPU_ARMEL) && !defined(ARCH_CPU_ARM64)) | |
728 // TODO(primiano): For the moment microdumps are enabled only on arm (32/64). | 722 // TODO(primiano): For the moment microdumps are enabled only on arm (32/64). |
729 // Extend support to other architectures (requires some breakpad changes). | 723 // Extend support to other architectures (requires some breakpad changes). |
730 return; | 724 return; |
731 #endif | 725 #endif |
| 726 |
| 727 if (!GetCrashReporterClient()->ShouldEnableBreakpadMicrodumps()) |
| 728 return; |
| 729 |
732 VLOG(1) << "Enabling microdumps crash handler (process_type:" | 730 VLOG(1) << "Enabling microdumps crash handler (process_type:" |
733 << process_type << ")"; | 731 << process_type << ")"; |
734 DCHECK(!g_microdump); | 732 DCHECK(!g_microdump); |
735 g_microdump = new ExceptionHandler( | 733 g_microdump = new ExceptionHandler( |
736 MinidumpDescriptor(MinidumpDescriptor::kMicrodumpOnConsole), | 734 MinidumpDescriptor(MinidumpDescriptor::kMicrodumpOnConsole), |
737 NULL, | 735 NULL, |
738 MicrodumpCrashDone, | 736 MicrodumpCrashDone, |
739 reinterpret_cast<void*>(process_type.empty()), | 737 reinterpret_cast<void*>(process_type.empty()), |
740 true, // Install handlers. | 738 true, // Install handlers. |
741 -1); // Server file descriptor. -1 for in-process. | 739 -1); // Server file descriptor. -1 for in-process. |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 } | 1707 } |
1710 } | 1708 } |
1711 } | 1709 } |
1712 #endif // OS_ANDROID | 1710 #endif // OS_ANDROID |
1713 | 1711 |
1714 bool IsCrashReporterEnabled() { | 1712 bool IsCrashReporterEnabled() { |
1715 return g_is_crash_reporter_enabled; | 1713 return g_is_crash_reporter_enabled; |
1716 } | 1714 } |
1717 | 1715 |
1718 } // namespace breakpad | 1716 } // namespace breakpad |
OLD | NEW |