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 #import "components/crash/app/breakpad_mac.h" | 5 #import "components/crash/app/breakpad_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl, | 245 base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl, |
246 &ClearCrashKeyValueImpl); | 246 &ClearCrashKeyValueImpl); |
247 GetCrashReporterClient()->RegisterCrashKeys(); | 247 GetCrashReporterClient()->RegisterCrashKeys(); |
248 | 248 |
249 // Set Breakpad metadata values. These values are added to Info.plist during | 249 // Set Breakpad metadata values. These values are added to Info.plist during |
250 // the branded Google Chrome.app build. | 250 // the branded Google Chrome.app build. |
251 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]); | 251 SetCrashKeyValue(@"ver", [info_dictionary objectForKey:@BREAKPAD_VERSION]); |
252 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); | 252 SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); |
253 SetCrashKeyValue(@"plat", @"OS X"); | 253 SetCrashKeyValue(@"plat", @"OS X"); |
254 | 254 |
255 if (!is_browser) { | |
256 // Get the guid from the command line switch. | |
257 std::string client_guid = | |
258 command_line->GetSwitchValueASCII(switches::kEnableCrashReporter); | |
259 GetCrashReporterClient()->SetCrashReporterClientIdFromGUID(client_guid); | |
260 } | |
261 | |
262 logging::SetLogMessageHandler(&FatalMessageHandler); | 255 logging::SetLogMessageHandler(&FatalMessageHandler); |
263 base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); | 256 base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); |
264 | 257 |
265 // abort() sends SIGABRT, which breakpad does not intercept. | 258 // abort() sends SIGABRT, which breakpad does not intercept. |
266 // Register a signal handler to crash in a way breakpad will | 259 // Register a signal handler to crash in a way breakpad will |
267 // intercept. | 260 // intercept. |
268 struct sigaction sigact; | 261 struct sigaction sigact; |
269 memset(&sigact, 0, sizeof(sigact)); | 262 memset(&sigact, 0, sizeof(sigact)); |
270 sigact.sa_handler = SIGABRTHandler; | 263 sigact.sa_handler = SIGABRTHandler; |
271 CHECK(0 == sigaction(SIGABRT, &sigact, NULL)); | 264 CHECK(0 == sigaction(SIGABRT, &sigact, NULL)); |
(...skipping 12 matching lines...) Expand all Loading... |
284 | 277 |
285 // Store process type in crash dump. | 278 // Store process type in crash dump. |
286 SetCrashKeyValue(@"ptype", process_type); | 279 SetCrashKeyValue(@"ptype", process_type); |
287 | 280 |
288 NSString* pid_value = | 281 NSString* pid_value = |
289 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; | 282 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; |
290 SetCrashKeyValue(@"pid", pid_value); | 283 SetCrashKeyValue(@"pid", pid_value); |
291 } | 284 } |
292 | 285 |
293 } // namespace breakpad | 286 } // namespace breakpad |
OLD | NEW |