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 // 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/content/app/breakpad_linux.h" | 8 #include "components/crash/content/app/breakpad_linux.h" |
| 9 | 9 |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 bool g_is_crash_reporter_enabled = false; | 94 bool g_is_crash_reporter_enabled = false; |
| 95 uint64_t g_process_start_time = 0; | 95 uint64_t g_process_start_time = 0; |
| 96 pid_t g_pid = 0; | 96 pid_t g_pid = 0; |
| 97 char* g_crash_log_path = nullptr; | 97 char* g_crash_log_path = nullptr; |
| 98 ExceptionHandler* g_breakpad = nullptr; | 98 ExceptionHandler* g_breakpad = nullptr; |
| 99 | 99 |
| 100 #if defined(ADDRESS_SANITIZER) | 100 #if defined(ADDRESS_SANITIZER) |
| 101 const char* g_asan_report_str = nullptr; | 101 const char* g_asan_report_str = nullptr; |
| 102 #endif | 102 #endif |
| 103 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
| 104 const char kWebViewProcessType[] = "webview"; | 104 const char kWebViewSingleProcessType[] = "webview-singleprocess"; |
|
hush (inactive)
2016/06/22 21:34:19
I hope this change does not break anything that tr
Torne
2016/06/23 13:40:10
Since we don't upload the string currently I don't
hush (inactive)
2016/06/23 19:13:14
Does chrome actually run in single process mode in
hush (inactive)
2016/06/24 20:18:46
Anyway... I went with #1 in the next patch set. Le
| |
| 105 char* g_process_type = nullptr; | 105 char* g_process_type = nullptr; |
| 106 ExceptionHandler* g_microdump = nullptr; | 106 ExceptionHandler* g_microdump = nullptr; |
| 107 int g_signal_code_pipe_fd = -1; | 107 int g_signal_code_pipe_fd = -1; |
| 108 | 108 |
| 109 class MicrodumpInfo { | 109 class MicrodumpInfo { |
| 110 public: | 110 public: |
| 111 MicrodumpInfo() | 111 MicrodumpInfo() |
| 112 : microdump_build_fingerprint_(nullptr), | 112 : microdump_build_fingerprint_(nullptr), |
| 113 microdump_product_info_(nullptr), | 113 microdump_product_info_(nullptr), |
| 114 microdump_gpu_fingerprint_(nullptr) {} | 114 microdump_gpu_fingerprint_(nullptr) {} |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 130 void Initialize(const std::string& process_type, | 130 void Initialize(const std::string& process_type, |
| 131 const char* product_name, | 131 const char* product_name, |
| 132 const char* product_version, | 132 const char* product_version, |
| 133 const char* android_build_fp); | 133 const char* android_build_fp); |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 base::ThreadChecker thread_checker_; | 136 base::ThreadChecker thread_checker_; |
| 137 const char* microdump_build_fingerprint_; | 137 const char* microdump_build_fingerprint_; |
| 138 const char* microdump_product_info_; | 138 const char* microdump_product_info_; |
| 139 const char* microdump_gpu_fingerprint_; | 139 const char* microdump_gpu_fingerprint_; |
| 140 const char* microdump_process_type_; | |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 base::LazyInstance<MicrodumpInfo> g_microdump_info = | 143 base::LazyInstance<MicrodumpInfo> g_microdump_info = |
| 143 LAZY_INSTANCE_INITIALIZER; | 144 LAZY_INSTANCE_INITIALIZER; |
| 144 | 145 |
| 145 #endif | 146 #endif |
| 146 | 147 |
| 147 CrashKeyStorage* g_crash_keys = nullptr; | 148 CrashKeyStorage* g_crash_keys = nullptr; |
| 148 | 149 |
| 149 // Writes the value |v| as 16 hex characters to the memory pointed at by | 150 // Writes the value |v| as 16 hex characters to the memory pointed at by |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 876 } | 877 } |
| 877 } | 878 } |
| 878 | 879 |
| 879 void MicrodumpInfo::Initialize(const std::string& process_type, | 880 void MicrodumpInfo::Initialize(const std::string& process_type, |
| 880 const char* product_name, | 881 const char* product_name, |
| 881 const char* product_version, | 882 const char* product_version, |
| 882 const char* android_build_fp) { | 883 const char* android_build_fp) { |
| 883 DCHECK(thread_checker_.CalledOnValidThread()); | 884 DCHECK(thread_checker_.CalledOnValidThread()); |
| 884 DCHECK(!g_microdump); | 885 DCHECK(!g_microdump); |
| 885 bool is_browser_process = | 886 bool is_browser_process = |
| 886 process_type.empty() || process_type == kWebViewProcessType; | 887 process_type.empty() || process_type == kWebViewSingleProcessType; |
| 887 | 888 |
| 888 MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole); | 889 MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole); |
| 889 | 890 |
| 890 if (product_name && product_version) { | 891 if (product_name && product_version) { |
| 891 microdump_product_info_ = | 892 microdump_product_info_ = |
| 892 strdup((product_name + std::string(":") + product_version).c_str()); | 893 strdup((product_name + std::string(":") + product_version).c_str()); |
| 893 ANNOTATE_LEAKING_OBJECT_PTR(microdump_product_info_); | 894 ANNOTATE_LEAKING_OBJECT_PTR(microdump_product_info_); |
| 894 descriptor.microdump_extra_info()->product_info = microdump_product_info_; | 895 descriptor.microdump_extra_info()->product_info = microdump_product_info_; |
| 895 } | 896 } |
| 896 | 897 |
| 898 // MicroDumpExtraInfo::process_type will have 3 possible values: | |
| 899 // webview-singleprocess, browser, renderer | |
| 900 microdump_process_type_ = | |
| 901 strdup(process_type.empty() ? "browser" : process_type.c_str()); | |
| 902 ANNOTATE_LEAKING_OBJECT_PTR(microdump_process_type_); | |
| 903 descriptor.microdump_extra_info()->process_type = microdump_process_type_; | |
| 904 | |
| 897 if (android_build_fp) { | 905 if (android_build_fp) { |
| 898 microdump_build_fingerprint_ = strdup(android_build_fp); | 906 microdump_build_fingerprint_ = strdup(android_build_fp); |
| 899 ANNOTATE_LEAKING_OBJECT_PTR(microdump_build_fingerprint_); | 907 ANNOTATE_LEAKING_OBJECT_PTR(microdump_build_fingerprint_); |
| 900 descriptor.microdump_extra_info()->build_fingerprint = | 908 descriptor.microdump_extra_info()->build_fingerprint = |
| 901 microdump_build_fingerprint_; | 909 microdump_build_fingerprint_; |
| 902 } | 910 } |
| 903 | 911 |
| 904 if (microdump_gpu_fingerprint_) { | 912 if (microdump_gpu_fingerprint_) { |
| 905 descriptor.microdump_extra_info()->gpu_fingerprint = | 913 descriptor.microdump_extra_info()->gpu_fingerprint = |
| 906 microdump_gpu_fingerprint_; | 914 microdump_gpu_fingerprint_; |
| 907 } | 915 } |
| 908 | 916 |
| 909 g_microdump = | 917 g_microdump = |
| 910 new ExceptionHandler(descriptor, nullptr, MicrodumpCrashDone, | 918 new ExceptionHandler(descriptor, nullptr, MicrodumpCrashDone, |
| 911 reinterpret_cast<void*>(is_browser_process), | 919 reinterpret_cast<void*>(is_browser_process), |
| 912 true, // Install handlers. | 920 true, // Install handlers. |
| 913 -1); // Server file descriptor. -1 for in-process. | 921 -1); // Server file descriptor. -1 for in-process. |
| 914 | 922 |
| 915 if (process_type == kWebViewProcessType) { | 923 if (process_type == kWebViewSingleProcessType) { |
|
Torne
2016/06/23 13:40:10
There's a problem here, which is not introduced by
hush (inactive)
2016/06/23 19:13:14
Added Toby to the CL.
Toby, should SetDumpWithoutC
Tobias Sargeant
2016/06/24 15:39:08
We should definitely set this for both single and
hush (inactive)
2016/06/24 20:18:46
All right. I uploaded new patch set with a todo in
| |
| 916 // We do not use |DumpProcess()| for handling programatically | 924 // We do not use |DumpProcess()| for handling programatically |
| 917 // generated dumps for WebView because we only know the file | 925 // generated dumps for WebView because we only know the file |
| 918 // descriptor to which we are dumping at the time of the call to | 926 // descriptor to which we are dumping at the time of the call to |
| 919 // |DumpWithoutCrashing()|. Therefore we need to construct the | 927 // |DumpWithoutCrashing()|. Therefore we need to construct the |
| 920 // |MinidumpDescriptor| and |ExceptionHandler| instances as | 928 // |MinidumpDescriptor| and |ExceptionHandler| instances as |
| 921 // needed, instead of setting up |g_breakpad| at initialization | 929 // needed, instead of setting up |g_breakpad| at initialization |
| 922 // time. | 930 // time. |
| 923 base::debug::SetDumpWithoutCrashingFunction( | 931 base::debug::SetDumpWithoutCrashingFunction( |
| 924 &GenerateMinidumpOnDemandForAndroid); | 932 &GenerateMinidumpOnDemandForAndroid); |
| 925 } else if (!process_type.empty()) { | 933 } else if (!process_type.empty()) { |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1922 const std::string& gpu_fingerprint) { | 1930 const std::string& gpu_fingerprint) { |
| 1923 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); | 1931 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); |
| 1924 } | 1932 } |
| 1925 #endif // OS_ANDROID | 1933 #endif // OS_ANDROID |
| 1926 | 1934 |
| 1927 bool IsCrashReporterEnabled() { | 1935 bool IsCrashReporterEnabled() { |
| 1928 return g_is_crash_reporter_enabled; | 1936 return g_is_crash_reporter_enabled; |
| 1929 } | 1937 } |
| 1930 | 1938 |
| 1931 } // namespace breakpad | 1939 } // namespace breakpad |
| OLD | NEW |