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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Minidump with stacks, PEB, TEBs and unloaded module list. | 119 // Minidump with stacks, PEB, TEBs and unloaded module list. |
120 MINIDUMP_TYPE dump_type = static_cast<MINIDUMP_TYPE>( | 120 MINIDUMP_TYPE dump_type = static_cast<MINIDUMP_TYPE>( |
121 MiniDumpWithProcessThreadData | // Get PEB and TEB. | 121 MiniDumpWithProcessThreadData | // Get PEB and TEB. |
122 MiniDumpWithUnloadedModules | // Get unloaded modules when available. | 122 MiniDumpWithUnloadedModules | // Get unloaded modules when available. |
123 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by | 123 MiniDumpWithIndirectlyReferencedMemory); // Get memory referenced by |
124 // stack. | 124 // stack. |
125 | 125 |
126 // Convert #define to a variable so that we can use if() rather than | 126 // Convert #define to a variable so that we can use if() rather than |
127 // #if below and so at least compile-test the Chrome code in | 127 // #if below and so at least compile-test the Chrome code in |
128 // Chromium builds. | 128 // Chromium builds. |
129 #if defined(GOOGLE_CHROME_BUILD) | 129 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD) |
130 bool is_chrome_build = true; | 130 bool is_official_chrome_build = true; |
131 #else | 131 #else |
132 bool is_chrome_build = false; | 132 bool is_official_chrome_build = false; |
133 #endif | 133 #endif |
134 | 134 |
135 base::string16 pipe_name; | 135 base::string16 pipe_name; |
136 | 136 |
137 bool enabled_by_policy = false; | 137 bool enabled_by_policy = false; |
138 bool use_policy = ReportingIsEnforcedByPolicy(&enabled_by_policy); | 138 bool use_policy = ReportingIsEnforcedByPolicy(&enabled_by_policy); |
139 | 139 |
140 if (!use_policy && IsHeadless()) { | 140 if (!use_policy && IsHeadless()) { |
141 pipe_name = kChromePipeName; | 141 pipe_name = kChromePipeName; |
142 } else if (use_policy ? enabled_by_policy : | 142 } else if (use_policy ? |
143 (is_chrome_build && AreUsageStatsEnabled(exe_path))) { | 143 enabled_by_policy : |
| 144 (is_official_chrome_build && AreUsageStatsEnabled(exe_path))) { |
144 // Build the pipe name. It can be one of: | 145 // Build the pipe name. It can be one of: |
145 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18 | 146 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18 |
146 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID> | 147 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID> |
147 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64 | 148 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64 |
148 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64 | 149 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64 |
149 base::string16 user_sid = IsSystemInstall(exe_path) ? kSystemPrincipalSid : | 150 base::string16 user_sid = IsSystemInstall(exe_path) ? kSystemPrincipalSid : |
150 GetUserSidString(); | 151 GetUserSidString(); |
151 if (user_sid.empty()) | 152 if (user_sid.empty()) |
152 return; | 153 return; |
153 | 154 |
(...skipping 17 matching lines...) Expand all Loading... |
171 google_breakpad::ExceptionHandler::HANDLER_ALL, | 172 google_breakpad::ExceptionHandler::HANDLER_ALL, |
172 dump_type, | 173 dump_type, |
173 pipe_name.c_str(), | 174 pipe_name.c_str(), |
174 GetCustomInfo()); | 175 GetCustomInfo()); |
175 | 176 |
176 if (g_elf_breakpad->IsOutOfProcess()) { | 177 if (g_elf_breakpad->IsOutOfProcess()) { |
177 // Tells breakpad to handle breakpoint and single step exceptions. | 178 // Tells breakpad to handle breakpoint and single step exceptions. |
178 g_elf_breakpad->set_handle_debug_exceptions(true); | 179 g_elf_breakpad->set_handle_debug_exceptions(true); |
179 } | 180 } |
180 } | 181 } |
OLD | NEW |