Chromium Code Reviews| 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 // Public interface for enabling Breakpad on Linux systems. | 5 // Public interface for enabling Breakpad on Linux systems. |
| 6 | 6 |
| 7 #ifndef COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ | 7 #ifndef COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ |
| 8 #define COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ | 8 #define COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 namespace breakpad { | 14 namespace breakpad { |
| 15 | 15 |
| 16 #if defined(OS_ANDROID) | |
| 17 struct SanitizationInfo { | |
| 18 bool should_sanitize_dumps; | |
|
Primiano Tucci (use gerrit)
2017/02/15 18:39:08
FYI these days you can use Non-Static Class Member
gsennton
2017/02/16 10:46:49
Done.
| |
| 19 bool skip_dump_if_principal_mapping_not_referenced; | |
| 20 uintptr_t address_within_principal_mapping; | |
| 21 | |
| 22 SanitizationInfo() | |
| 23 : should_sanitize_dumps(false), | |
| 24 skip_dump_if_principal_mapping_not_referenced(false), | |
| 25 address_within_principal_mapping(0) {} | |
| 26 }; | |
| 27 | |
| 16 // Turns on the crash reporter in any process. | 28 // Turns on the crash reporter in any process. |
| 17 extern void InitCrashReporter(const std::string& process_type); | 29 extern void InitCrashReporter(const std::string& process_type); |
| 30 extern void InitCrashReporter(const std::string& process_type, | |
| 31 const SanitizationInfo& sanitization_info); | |
| 32 #else | |
| 33 extern void InitCrashReporter(const std::string& process_type); | |
|
Primiano Tucci (use gerrit)
2017/02/15 18:39:08
looks like you can factor this out of the #if bloc
gsennton
2017/02/16 10:46:49
Moved this above SanitizationInfo instead and merg
| |
| 34 #endif // defined(OS_ANDROID) | |
| 18 | 35 |
| 19 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
| 20 | |
| 21 const char kWebViewSingleProcessType[] = "webview"; | 37 const char kWebViewSingleProcessType[] = "webview"; |
| 22 const char kBrowserProcessType[] = "browser"; | 38 const char kBrowserProcessType[] = "browser"; |
| 23 | 39 |
| 24 // Enables the crash reporter in child processes. | 40 // Enables the crash reporter in child processes. |
| 25 extern void InitNonBrowserCrashReporterForAndroid( | 41 extern void InitNonBrowserCrashReporterForAndroid( |
| 26 const std::string& process_type); | 42 const std::string& process_type); |
| 43 // Enables the crash reporter in child processes. | |
| 44 extern void InitNonBrowserCrashReporterForAndroid( | |
| 45 const std::string& process_type, | |
| 46 const SanitizationInfo& sanitization_info); | |
| 27 | 47 |
| 28 // Enables *micro*dump only. Can be called from any process. | 48 // Enables *micro*dump only. Can be called from any process. |
| 29 extern void InitMicrodumpCrashHandlerIfNecessary( | 49 extern void InitMicrodumpCrashHandlerIfNecessary( |
| 30 const std::string& process_type); | 50 const std::string& process_type, |
| 51 const SanitizationInfo& sanitization_info); | |
| 31 | 52 |
| 32 extern void AddGpuFingerprintToMicrodumpCrashHandler( | 53 extern void AddGpuFingerprintToMicrodumpCrashHandler( |
| 33 const std::string& gpu_fingerprint); | 54 const std::string& gpu_fingerprint); |
| 34 | 55 |
| 35 // Calling SuppressDumpGeneration causes subsequent crashes to not | 56 // Calling SuppressDumpGeneration causes subsequent crashes to not |
| 36 // generate dumps. Calling base::debug::DumpWithoutCrashing will still | 57 // generate dumps. Calling base::debug::DumpWithoutCrashing will still |
| 37 // generate a dump. | 58 // generate a dump. |
| 38 extern void SuppressDumpGeneration(); | 59 extern void SuppressDumpGeneration(); |
| 39 | |
| 40 // Calling SetShouldSanitizeDumps determines whether or not subsequent | |
| 41 // crash dumps should be sanitized. Sanitized dumps still contain | |
| 42 // enough stack information to unwind crashes, but other stack data is | |
| 43 // erased. | |
| 44 extern void SetShouldSanitizeDumps(bool sanitize_dumps); | |
| 45 | |
| 46 // Inform breakpad of an address within the text section that is | |
| 47 // considered interesting for the purpose of crashes so that this can | |
| 48 // be used to elide microdumps that do not reference interesting | |
| 49 // code. Minidumps will still be generated, but stacks from threads | |
| 50 // that do not reference the principal mapping will not be included. | |
| 51 // The full interesting address range is determined by looking up the | |
| 52 // memory mapping that contains |addr|. | |
| 53 extern void SetSkipDumpIfPrincipalMappingNotReferenced( | |
| 54 uintptr_t address_within_principal_mapping); | |
| 55 #endif | 60 #endif |
| 56 | 61 |
| 57 // Checks if crash reporting is enabled. Note that this is not the same as | 62 // Checks if crash reporting is enabled. Note that this is not the same as |
| 58 // being opted into metrics reporting (and crash reporting), which controls | 63 // being opted into metrics reporting (and crash reporting), which controls |
| 59 // whether InitCrashReporter() is called. | 64 // whether InitCrashReporter() is called. |
| 60 bool IsCrashReporterEnabled(); | 65 bool IsCrashReporterEnabled(); |
| 61 | 66 |
| 62 // Generates a minidump on demand for this process, writing it to |dump_fd|. | 67 // Generates a minidump on demand for this process, writing it to |dump_fd|. |
| 63 void GenerateMinidumpOnDemandForAndroid(int dump_fd); | 68 void GenerateMinidumpOnDemandForAndroid(int dump_fd); |
| 64 } // namespace breakpad | 69 } // namespace breakpad |
| 65 | 70 |
| 66 #endif // COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ | 71 #endif // COMPONENTS_CRASH_CONTENT_APP_BREAKPAD_LINUX_H_ |
| OLD | NEW |