OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This module contains the necessary code to register the Breakpad exception | 5 // This module contains the necessary code to register the Breakpad exception |
6 // handler. This implementation is based on Chrome's crash reporting code. | 6 // handler. This implementation is based on Chrome's crash reporting code. |
7 | 7 |
8 #include "chrome_elf/breakpad.h" | 8 #include "chrome_elf/breakpad.h" |
9 | 9 |
10 #include <sddl.h> | 10 #include <sddl.h> |
(...skipping 20 matching lines...) Expand all Loading... |
31 // are different because the message struct contains a pointer. As | 31 // are different because the message struct contains a pointer. As |
32 // a result, there are two different named pipes to connect to. The | 32 // a result, there are two different named pipes to connect to. The |
33 // 64-bit one is distinguished with an "-x64" suffix. | 33 // 64-bit one is distinguished with an "-x64" suffix. |
34 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\"; | 34 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\"; |
35 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; | 35 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; |
36 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; | 36 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; |
37 | 37 |
38 const wchar_t kNoErrorDialogs[] = L"noerrdialogs"; | 38 const wchar_t kNoErrorDialogs[] = L"noerrdialogs"; |
39 | 39 |
40 google_breakpad::CustomClientInfo* GetCustomInfo() { | 40 google_breakpad::CustomClientInfo* GetCustomInfo() { |
41 base::string16 process = IsNonBrowserProcess() ? L"renderer" : L"browser"; | 41 base::string16 process = |
| 42 install_static::IsNonBrowserProcess() ? L"renderer" : L"browser"; |
42 | 43 |
43 wchar_t exe_path[MAX_PATH] = {}; | 44 wchar_t exe_path[MAX_PATH] = {}; |
44 base::string16 channel; | 45 base::string16 channel; |
45 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) && | 46 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) && |
46 IsCanary(exe_path)) { | 47 install_static::IsCanary(exe_path)) { |
47 channel = L"canary"; | 48 channel = L"canary"; |
48 } | 49 } |
49 | 50 |
50 static google_breakpad::CustomInfoEntry ver_entry( | 51 static google_breakpad::CustomInfoEntry ver_entry( |
51 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING)); | 52 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING)); |
52 static google_breakpad::CustomInfoEntry prod_entry( | 53 static google_breakpad::CustomInfoEntry prod_entry( |
53 kBreakpadProdEntry, kBreakpadProductName); | 54 kBreakpadProdEntry, kBreakpadProductName); |
54 static google_breakpad::CustomInfoEntry plat_entry( | 55 static google_breakpad::CustomInfoEntry plat_entry( |
55 kBreakpadPlatformEntry, kBreakpadPlatformWin32); | 56 kBreakpadPlatformEntry, kBreakpadPlatformWin32); |
56 static google_breakpad::CustomInfoEntry proc_entry( | 57 static google_breakpad::CustomInfoEntry proc_entry( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 140 |
140 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD) | 141 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD) |
141 bool is_official_chrome_build = true; | 142 bool is_official_chrome_build = true; |
142 #else | 143 #else |
143 bool is_official_chrome_build = false; | 144 bool is_official_chrome_build = false; |
144 #endif | 145 #endif |
145 | 146 |
146 base::string16 pipe_name; | 147 base::string16 pipe_name; |
147 | 148 |
148 bool enabled_by_policy = false; | 149 bool enabled_by_policy = false; |
149 bool use_policy = ReportingIsEnforcedByPolicy(&enabled_by_policy); | 150 bool use_policy = install_static::ReportingIsEnforcedByPolicy( |
| 151 &enabled_by_policy); |
150 | 152 |
151 if (!use_policy && IsHeadless()) { | 153 if (!use_policy && IsHeadless()) { |
152 pipe_name = kChromePipeName; | 154 pipe_name = kChromePipeName; |
153 } else if (use_policy ? | 155 } else if (use_policy ? |
154 enabled_by_policy : | 156 enabled_by_policy : |
155 (is_official_chrome_build && AreUsageStatsEnabled(exe_path))) { | 157 (is_official_chrome_build && |
| 158 install_static::GetCollectStatsConsent())) { |
156 // Build the pipe name. It can be one of: | 159 // Build the pipe name. It can be one of: |
157 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18 | 160 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18 |
158 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID> | 161 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID> |
159 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64 | 162 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64 |
160 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64 | 163 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64 |
161 base::string16 user_sid = IsSystemInstall(exe_path) ? kSystemPrincipalSid : | 164 base::string16 user_sid = |
162 GetUserSidString(); | 165 install_static::IsSystemInstall(exe_path) ? kSystemPrincipalSid : |
| 166 GetUserSidString(); |
163 if (user_sid.empty()) | 167 if (user_sid.empty()) |
164 return; | 168 return; |
165 | 169 |
166 pipe_name = kGoogleUpdatePipeName; | 170 pipe_name = kGoogleUpdatePipeName; |
167 pipe_name += user_sid; | 171 pipe_name += user_sid; |
168 | 172 |
169 #if defined(_WIN64) | 173 #if defined(_WIN64) |
170 pipe_name += L"-x64"; | 174 pipe_name += L"-x64"; |
171 #endif | 175 #endif |
172 } else { | 176 } else { |
(...skipping 10 matching lines...) Expand all Loading... |
183 google_breakpad::ExceptionHandler::HANDLER_ALL, | 187 google_breakpad::ExceptionHandler::HANDLER_ALL, |
184 dump_type, | 188 dump_type, |
185 pipe_name.c_str(), | 189 pipe_name.c_str(), |
186 GetCustomInfo()); | 190 GetCustomInfo()); |
187 | 191 |
188 if (g_elf_breakpad->IsOutOfProcess()) { | 192 if (g_elf_breakpad->IsOutOfProcess()) { |
189 // Tells breakpad to handle breakpoint and single step exceptions. | 193 // Tells breakpad to handle breakpoint and single step exceptions. |
190 g_elf_breakpad->set_handle_debug_exceptions(true); | 194 g_elf_breakpad->set_handle_debug_exceptions(true); |
191 } | 195 } |
192 } | 196 } |
OLD | NEW |