| 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/breakpad/app/breakpad_mac.h" | 5 #import "components/breakpad/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" |
| 11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 12 #import "base/basictypes.h" | 12 #import "base/basictypes.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/crash_logging.h" | 14 #include "base/debug/crash_logging.h" |
| 15 #include "base/debug/dump_without_crashing.h" |
| 15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 16 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 17 #import "base/logging.h" | 18 #import "base/logging.h" |
| 18 #include "base/mac/bundle_locations.h" | 19 #include "base/mac/bundle_locations.h" |
| 19 #include "base/mac/mac_util.h" | 20 #include "base/mac/mac_util.h" |
| 20 #include "base/mac/scoped_cftyperef.h" | 21 #include "base/mac/scoped_cftyperef.h" |
| 21 #import "base/mac/scoped_nsautorelease_pool.h" | 22 #import "base/mac/scoped_nsautorelease_pool.h" |
| 22 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
| 23 #include "base/threading/platform_thread.h" | 24 #include "base/threading/platform_thread.h" |
| 24 #include "base/threading/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 SetCrashKeyValue(@"plat", @"OS X"); | 237 SetCrashKeyValue(@"plat", @"OS X"); |
| 237 | 238 |
| 238 if (!is_browser) { | 239 if (!is_browser) { |
| 239 // Get the guid from the command line switch. | 240 // Get the guid from the command line switch. |
| 240 std::string guid = | 241 std::string guid = |
| 241 command_line->GetSwitchValueASCII(switches::kEnableCrashReporter); | 242 command_line->GetSwitchValueASCII(switches::kEnableCrashReporter); |
| 242 GetBreakpadClient()->SetClientID(guid); | 243 GetBreakpadClient()->SetClientID(guid); |
| 243 } | 244 } |
| 244 | 245 |
| 245 logging::SetLogMessageHandler(&FatalMessageHandler); | 246 logging::SetLogMessageHandler(&FatalMessageHandler); |
| 246 GetBreakpadClient()->SetDumpWithoutCrashingFunction( | 247 base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); |
| 247 &DumpHelper::DumpWithoutCrashing); | |
| 248 | 248 |
| 249 // abort() sends SIGABRT, which breakpad does not intercept. | 249 // abort() sends SIGABRT, which breakpad does not intercept. |
| 250 // Register a signal handler to crash in a way breakpad will | 250 // Register a signal handler to crash in a way breakpad will |
| 251 // intercept. | 251 // intercept. |
| 252 struct sigaction sigact; | 252 struct sigaction sigact; |
| 253 memset(&sigact, 0, sizeof(sigact)); | 253 memset(&sigact, 0, sizeof(sigact)); |
| 254 sigact.sa_handler = SIGABRTHandler; | 254 sigact.sa_handler = SIGABRTHandler; |
| 255 CHECK(0 == sigaction(SIGABRT, &sigact, NULL)); | 255 CHECK(0 == sigaction(SIGABRT, &sigact, NULL)); |
| 256 } | 256 } |
| 257 | 257 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 270 | 270 |
| 271 // Store process type in crash dump. | 271 // Store process type in crash dump. |
| 272 SetCrashKeyValue(@"ptype", process_type); | 272 SetCrashKeyValue(@"ptype", process_type); |
| 273 | 273 |
| 274 NSString* pid_value = | 274 NSString* pid_value = |
| 275 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; | 275 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; |
| 276 SetCrashKeyValue(@"pid", pid_value); | 276 SetCrashKeyValue(@"pid", pid_value); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace breakpad | 279 } // namespace breakpad |
| OLD | NEW |