diff options
-rw-r--r-- | base/base.gypi | 2 | ||||
-rw-r--r-- | base/mac/crash_logging.h | 49 | ||||
-rw-r--r-- | base/mac/crash_logging.mm | 43 | ||||
-rw-r--r-- | chrome/app/breakpad_mac.h | 26 | ||||
-rw-r--r-- | chrome/app/breakpad_mac.mm | 56 | ||||
-rw-r--r-- | chrome/app/breakpad_mac_stubs.mm | 21 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_application_mac.mm | 10 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/objc_zombie.mm | 6 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm | 3 | ||||
-rw-r--r-- | chrome/common/child_process_logging.h | 20 | ||||
-rw-r--r-- | chrome/common/child_process_logging_mac.mm | 36 | ||||
-rw-r--r-- | chrome/common/child_process_logging_mac_unittest.mm | 8 | ||||
-rw-r--r-- | chrome/common/mac/DEPS | 5 | ||||
-rw-r--r-- | chrome/common/mac/objc_zombie.mm | 6 | ||||
-rw-r--r-- | content/common/sandbox_mac.mm | 5 |
15 files changed, 163 insertions, 133 deletions
diff --git a/base/base.gypi b/base/base.gypi index 2db08e3..6220ea5 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -124,6 +124,8 @@ 'logging_win.cc', 'logging_win.h', 'mac/cocoa_protocols.h', + 'mac/crash_logging.h', + 'mac/crash_logging.mm', 'mac/foundation_util.h', 'mac/foundation_util.mm', 'mac/mac_util.h', diff --git a/base/mac/crash_logging.h b/base/mac/crash_logging.h new file mode 100644 index 0000000..006c847 --- /dev/null +++ b/base/mac/crash_logging.h @@ -0,0 +1,49 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_MAC_CRASH_LOGGING_H_ +#define BASE_MAC_CRASH_LOGGING_H_ + +#if __OBJC__ +#import "base/memory/scoped_nsobject.h" + +@class NSString; +#else +class NSString; +#endif + +namespace base { +namespace mac { + +typedef void (*SetCrashKeyValueFuncPtr)(NSString*, NSString*); +typedef void (*ClearCrashKeyValueFuncPtr)(NSString*); + +// Set the low level functions used to supply crash keys to Breakpad. +void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func, + ClearCrashKeyValueFuncPtr clear_key_func); + +// Set and clear meta information for Minidump. +// IMPORTANT: On OS X, the key/value pairs are sent to the crash server +// out of bounds and not recorded on disk in the minidump, this means +// that if you look at the minidump file locally you won't see them! +void SetCrashKeyValue(NSString* key, NSString* val); +void ClearCrashKey(NSString* key); + +#if __OBJC__ + +class ScopedCrashKey { + public: + ScopedCrashKey(NSString* key, NSString* value); + ~ScopedCrashKey(); + private: + scoped_nsobject<NSString> crash_key_; + DISALLOW_COPY_AND_ASSIGN(ScopedCrashKey); +}; + +#endif // __OBJC__ + +} // namespace mac +} // namespace base + +#endif // BASE_MAC_CRASH_LOGGING_H_ diff --git a/base/mac/crash_logging.mm b/base/mac/crash_logging.mm new file mode 100644 index 0000000..ce0db39 --- /dev/null +++ b/base/mac/crash_logging.mm @@ -0,0 +1,43 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/mac/crash_logging.h" + +#import <Foundation/Foundation.h> + +namespace base { +namespace mac { + +static SetCrashKeyValueFuncPtr g_set_key_func; +static ClearCrashKeyValueFuncPtr g_clear_key_func; + +void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func, + ClearCrashKeyValueFuncPtr clear_key_func) { + g_set_key_func = set_key_func; + g_clear_key_func = clear_key_func; +} + +void SetCrashKeyValue(NSString* key, NSString* val) { + if (g_set_key_func) + g_set_key_func(key, val); +} + +void ClearCrashKey(NSString* key) { + if (g_clear_key_func) + g_clear_key_func(key); +} + +ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) + : crash_key_([key retain]) { + if (g_set_key_func) + g_set_key_func(crash_key_, value); +} + +ScopedCrashKey::~ScopedCrashKey() { + if (g_clear_key_func) + g_clear_key_func(crash_key_); +} + +} // namespace mac +} // namespace base diff --git a/chrome/app/breakpad_mac.h b/chrome/app/breakpad_mac.h index b5eb9e0..b737f0d 100644 --- a/chrome/app/breakpad_mac.h +++ b/chrome/app/breakpad_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,28 +22,4 @@ bool IsCrashReporterEnabled(); // Call on clean process shutdown. void DestructCrashReporter(); -#ifdef __OBJC__ - -#include "base/memory/scoped_nsobject.h" - -@class NSString; - -// Set and clear meta information for Minidump. -// IMPORTANT: On OS X, the key/value pairs are sent to the crash server -// out of bounds and not recorded on disk in the minidump, this means -// that if you look at the minidump file locally you won't see them! -void SetCrashKeyValue(NSString* key, NSString* value); -void ClearCrashKeyValue(NSString* key); - -class ScopedCrashKey { - public: - ScopedCrashKey(NSString* key, NSString* value); - ~ScopedCrashKey(); - - private: - scoped_nsobject<NSString> crash_key_; -}; - -#endif // __OBJC__ - #endif // CHROME_APP_BREAKPAD_MAC_H_ diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm index 840ac47..4f4d11c 100644 --- a/chrome/app/breakpad_mac.mm +++ b/chrome/app/breakpad_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,6 +30,26 @@ namespace { BreakpadRef gBreakpadRef = NULL; +void SetCrashKeyValue(NSString* key, NSString* value) { + // Comment repeated from header to prevent confusion: + // IMPORTANT: On OS X, the key/value pairs are sent to the crash server + // out of bounds and not recorded on disk in the minidump, this means + // that if you look at the minidump file locally you won't see them! + if (gBreakpadRef == NULL) { + return; + } + + BreakpadAddUploadParameter(gBreakpadRef, key, value); +} + +void ClearCrashKeyValue(NSString* key) { + if (gBreakpadRef == NULL) { + return; + } + + BreakpadRemoveUploadParameter(gBreakpadRef, key); +} + } // namespace bool IsCrashReporterEnabled() { @@ -155,8 +175,8 @@ void InitCrashReporter() { // Enable child process crashes to include the page URL. // TODO: Should this only be done for certain process types? - child_process_logging::SetCrashKeyFunctions(SetCrashKeyValue, - ClearCrashKeyValue); + base::mac::SetCrashKeyFunctions(SetCrashKeyValue, + ClearCrashKeyValue); if (!is_browser) { // Get the guid from the command line switch. @@ -183,33 +203,3 @@ void InitCrashProcessInfo() { // Store process type in crash dump. SetCrashKeyValue(@"ptype", process_type); } - -void SetCrashKeyValue(NSString* key, NSString* value) { - // Comment repeated from header to prevent confusion: - // IMPORTANT: On OS X, the key/value pairs are sent to the crash server - // out of bounds and not recorded on disk in the minidump, this means - // that if you look at the minidump file locally you won't see them! - if (gBreakpadRef == NULL) { - return; - } - - BreakpadAddUploadParameter(gBreakpadRef, key, value); -} - -void ClearCrashKeyValue(NSString* key) { - if (gBreakpadRef == NULL) { - return; - } - - BreakpadRemoveUploadParameter(gBreakpadRef, key); -} - -// NOTE(shess): These also exist in breakpad_mac_stubs.mm. -ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) - : crash_key_([key retain]) { - SetCrashKeyValue(crash_key_.get(), value); -} - -ScopedCrashKey::~ScopedCrashKey() { - ClearCrashKeyValue(crash_key_.get()); -} diff --git a/chrome/app/breakpad_mac_stubs.mm b/chrome/app/breakpad_mac_stubs.mm index b07ded6..db2db6b 100644 --- a/chrome/app/breakpad_mac_stubs.mm +++ b/chrome/app/breakpad_mac_stubs.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,22 +21,3 @@ void DestructCrashReporter() { void InitCrashReporter() { } - -void SetCrashKeyValue(NSString* key, NSString* value) { -} - -void ClearCrashKeyValue(NSString* key) { -} - -// NOTE(shess): These functions could clearly be replaced by stubs, -// but since they are seldom-used helpers, it seemed more reasonable -// to duplicate them from the primary implementation in -// breakpad_mac.mm. -ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) - : crash_key_([key retain]) { - SetCrashKeyValue(crash_key_.get(), value); -} - -ScopedCrashKey::~ScopedCrashKey() { - ClearCrashKeyValue(crash_key_.get()); -} diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm index 852d2ba..c7706f2 100644 --- a/chrome/browser/chrome_browser_application_mac.mm +++ b/chrome/browser/chrome_browser_application_mac.mm @@ -5,11 +5,11 @@ #import "chrome/browser/chrome_browser_application_mac.h" #import "base/logging.h" +#include "base/mac/crash_logging.h" #import "base/mac/scoped_nsexception_enabler.h" #import "base/metrics/histogram.h" #import "base/memory/scoped_nsobject.h" #import "base/sys_string_conversions.h" -#import "chrome/app/breakpad_mac.h" #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" @@ -63,7 +63,7 @@ static IMP gOriginalInitIMP = NULL; static NSString* const kNSExceptionKey = @"nsexception"; NSString* value = [NSString stringWithFormat:@"%@ reason %@", aName, aReason]; - SetCrashKeyValue(kNSExceptionKey, value); + base::mac::SetCrashKeyValue(kNSExceptionKey, value); // Force crash for selected exceptions to generate crash dumps. BOOL fatal = NO; @@ -338,7 +338,7 @@ void SwizzleInit() { [NSString stringWithFormat:@"%@ tag %d sending %@ to %p", [sender className], tag, actionString, aTarget]; - ScopedCrashKey key(kActionKey, value); + base::mac::ScopedCrashKey key(kActionKey, value); // Certain third-party code, such as print drivers, can still throw // exceptions and Chromium cannot fix them. This provides a way to @@ -406,10 +406,10 @@ void SwizzleInit() { NSString* value = [NSString stringWithFormat:@"%@ reason %@", [anException name], [anException reason]]; if (!trackedFirstException) { - SetCrashKeyValue(kFirstExceptionKey, value); + base::mac::SetCrashKeyValue(kFirstExceptionKey, value); trackedFirstException = YES; } else { - SetCrashKeyValue(kLastExceptionKey, value); + base::mac::SetCrashKeyValue(kLastExceptionKey, value); } reportingException = NO; diff --git a/chrome/browser/ui/cocoa/objc_zombie.mm b/chrome/browser/ui/cocoa/objc_zombie.mm index ef6d458..0918fd7 100644 --- a/chrome/browser/ui/cocoa/objc_zombie.mm +++ b/chrome/browser/ui/cocoa/objc_zombie.mm @@ -16,10 +16,10 @@ #include "base/debug/stack_trace.h" #include "base/logging.h" +#include "base/mac/crash_logging.h" #include "base/mac/mac_util.h" #include "base/metrics/histogram.h" #include "base/synchronization/lock.h" -#import "chrome/app/breakpad_mac.h" #import "chrome/common/mac/objc_method_swizzle.h" // Deallocated objects are re-classed as |CrZombie|. No superclass @@ -284,7 +284,7 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) { } // Set a value for breakpad to report. - SetCrashKeyValue(@"zombie", aString); + base::mac::SetCrashKeyValue(@"zombie", aString); // Hex-encode the backtrace and tuck it into a breakpad key. NSString* deallocTrace = @"<unknown>"; @@ -300,7 +300,7 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) { // Warn someone if this exceeds the breakpad limits. DCHECK_LE(strlen([deallocTrace UTF8String]), 255U); } - SetCrashKeyValue(@"zombie_dealloc_bt", deallocTrace); + base::mac::SetCrashKeyValue(@"zombie_dealloc_bt", deallocTrace); // Log -dealloc backtrace in debug builds then crash with a useful // stack trace. diff --git a/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm b/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm index b962489..395526f1 100644 --- a/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm +++ b/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm @@ -7,6 +7,7 @@ #include <sys/param.h> #include "base/file_path.h" +#include "base/mac/crash_logging.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/task.h" @@ -60,7 +61,7 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) { // http://crbug.com/78782 static NSString* const kUrlKey = @"drop_data_url"; NSString* value = SysUTF8ToNSString(drop_data.url.spec()); - ScopedCrashKey key(kUrlKey, value); + base::mac::ScopedCrashKey key(kUrlKey, value); // Images without ALT text will only have a file extension so we need to // synthesize one from the provided extension and URL. diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index 7b80c82..0daabb8 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,6 +10,7 @@ #include <string> #include "base/basictypes.h" +#include "base/mac/crash_logging.h" #include "googleurl/src/gurl.h" struct GPUInfo; @@ -78,25 +79,20 @@ class ScopedActiveURLSetter { } // namespace child_process_logging -#if defined(OS_MACOSX) && __OBJC__ - -@class NSString; - -typedef void (*SetCrashKeyValueFuncPtr)(NSString*, NSString*); -typedef void (*ClearCrashKeyValueFuncPtr)(NSString*); +#if defined(OS_MACOSX) namespace child_process_logging { -void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func, - ClearCrashKeyValueFuncPtr clear_key_func); + void SetActiveURLImpl(const GURL& url, - SetCrashKeyValueFuncPtr set_key_func, - ClearCrashKeyValueFuncPtr clear_key_func); + base::mac::SetCrashKeyValueFuncPtr set_key_func, + base::mac::ClearCrashKeyValueFuncPtr clear_key_func); extern const int kMaxNumCrashURLChunks; extern const int kMaxNumURLChunkValueLength; extern const char *kUrlChunkFormatStr; + } // namespace child_process_logging -#endif // defined(OS_MACOSX) && __OBJC__ +#endif // defined(OS_MACOSX) #endif // CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index ab3d021..70ee2a7 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -16,6 +16,11 @@ namespace child_process_logging { +using base::mac::SetCrashKeyValueFuncPtr; +using base::mac::ClearCrashKeyValueFuncPtr; +using base::mac::SetCrashKeyValue; +using base::mac::ClearCrashKey; + const int kMaxNumCrashURLChunks = 8; const int kMaxNumURLChunkValueLength = 255; const char *kUrlChunkFormatStr = "url-chunk-%d"; @@ -30,19 +35,10 @@ const char *kNumberOfViews = "num-views"; NSString* const kNumExtensionsName = @"num-extensions"; NSString* const kExtensionNameFormat = @"extension-%d"; -static SetCrashKeyValueFuncPtr g_set_key_func; -static ClearCrashKeyValueFuncPtr g_clear_key_func; - // Account for the terminating null character. static const size_t kClientIdSize = 32 + 1; static char g_client_id[kClientIdSize]; -void SetCrashKeyFunctions(SetCrashKeyValueFuncPtr set_key_func, - ClearCrashKeyValueFuncPtr clear_key_func) { - g_set_key_func = set_key_func; - g_clear_key_func = clear_key_func; -} - void SetActiveURLImpl(const GURL& url, SetCrashKeyValueFuncPtr set_key_func, ClearCrashKeyValueFuncPtr clear_key_func) { @@ -94,8 +90,7 @@ void SetClientIdImpl(const std::string& client_id, } void SetActiveURL(const GURL& url) { - if (g_set_key_func && g_clear_key_func) - SetActiveURLImpl(url, g_set_key_func, g_clear_key_func); + SetActiveURLImpl(url, SetCrashKeyValue, ClearCrashKey); } void SetClientId(const std::string& client_id) { @@ -103,8 +98,7 @@ void SetClientId(const std::string& client_id) { ReplaceSubstringsAfterOffset(&str, 0, "-", ""); base::strlcpy(g_client_id, str.c_str(), kClientIdSize); - if (g_set_key_func) - SetClientIdImpl(str, g_set_key_func); + SetClientIdImpl(str, SetCrashKeyValue); std::wstring wstr = ASCIIToWide(str); GoogleUpdateSettings::SetMetricsId(wstr); @@ -115,12 +109,10 @@ std::string GetClientId() { } void SetActiveExtensions(const std::set<std::string>& extension_ids) { - if (!g_set_key_func) - return; - // Log the count separately to track heavy users. const int count = static_cast<int>(extension_ids.size()); - g_set_key_func(kNumExtensionsName, [NSString stringWithFormat:@"%i", count]); + SetCrashKeyValue(kNumExtensionsName, + [NSString stringWithFormat:@"%i", count]); // Record up to |kMaxReportedActiveExtensions| extensions, clearing // keys if there aren't that many. @@ -128,10 +120,10 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) { for (int i = 0; i < kMaxReportedActiveExtensions; ++i) { NSString* key = [NSString stringWithFormat:kExtensionNameFormat, i]; if (iter != extension_ids.end()) { - g_set_key_func(key, [NSString stringWithUTF8String:iter->c_str()]); + SetCrashKeyValue(key, [NSString stringWithUTF8String:iter->c_str()]); ++iter; } else { - g_clear_key_func(key); + ClearCrashKey(key); } } } @@ -166,8 +158,7 @@ void SetGpuInfoImpl(const GPUInfo& gpu_info, } void SetGpuInfo(const GPUInfo& gpu_info) { - if (g_set_key_func) - SetGpuInfoImpl(gpu_info, g_set_key_func); + SetGpuInfoImpl(gpu_info, SetCrashKeyValue); } @@ -179,8 +170,7 @@ void SetNumberOfViewsImpl(int number_of_views, } void SetNumberOfViews(int number_of_views) { - if (g_set_key_func) - SetNumberOfViewsImpl(number_of_views, g_set_key_func); + SetNumberOfViewsImpl(number_of_views, SetCrashKeyValue); } } // namespace child_process_logging diff --git a/chrome/common/child_process_logging_mac_unittest.mm b/chrome/common/child_process_logging_mac_unittest.mm index a751287..feedcbe 100644 --- a/chrome/common/child_process_logging_mac_unittest.mm +++ b/chrome/common/child_process_logging_mac_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> #include "base/logging.h" +#include "base/mac/crash_logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -88,8 +89,9 @@ NSMutableDictionary* MockBreakpadKeyValueStore::dict; void SetActiveURLWithMock(const GURL& url) { using child_process_logging::SetActiveURLImpl; - SetCrashKeyValueFuncPtr setFunc = MockBreakpadKeyValueStore::SetKeyValue; - ClearCrashKeyValueFuncPtr clearFunc = + base::mac::SetCrashKeyValueFuncPtr setFunc = + MockBreakpadKeyValueStore::SetKeyValue; + base::mac::ClearCrashKeyValueFuncPtr clearFunc = MockBreakpadKeyValueStore::ClearKeyValue; SetActiveURLImpl(url, setFunc, clearFunc); diff --git a/chrome/common/mac/DEPS b/chrome/common/mac/DEPS index b0c96ed..77a551b 100644 --- a/chrome/common/mac/DEPS +++ b/chrome/common/mac/DEPS @@ -1,8 +1,3 @@ include_rules = [ - # TODO(shess): http://crbug.com/95272 - # This dependency needed by objc_zombie.mm. Unfortunately, putting - # objc_zombie.mm in chrome/app calls into existence unspeakable horrors. - "+chrome/app", - "+third_party/mach_override", ] diff --git a/chrome/common/mac/objc_zombie.mm b/chrome/common/mac/objc_zombie.mm index c60981b..3e9ce8a 100644 --- a/chrome/common/mac/objc_zombie.mm +++ b/chrome/common/mac/objc_zombie.mm @@ -16,10 +16,10 @@ #include "base/debug/stack_trace.h" #include "base/logging.h" +#include "base/mac/crash_logging.h" #include "base/mac/mac_util.h" #include "base/metrics/histogram.h" #include "base/synchronization/lock.h" -#import "chrome/app/breakpad_mac.h" #import "chrome/common/mac/objc_method_swizzle.h" // Deallocated objects are re-classed as |CrZombie|. No superclass @@ -284,7 +284,7 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) { } // Set a value for breakpad to report. - SetCrashKeyValue(@"zombie", aString); + base::mac::SetCrashKeyValue(@"zombie", aString); // Hex-encode the backtrace and tuck it into a breakpad key. NSString* deallocTrace = @"<unknown>"; @@ -300,7 +300,7 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) { // Warn someone if this exceeds the breakpad limits. DCHECK_LE(strlen([deallocTrace UTF8String]), 255U); } - SetCrashKeyValue(@"zombie_dealloc_bt", deallocTrace); + base::mac::SetCrashKeyValue(@"zombie_dealloc_bt", deallocTrace); // Log -dealloc backtrace in debug builds then crash with a useful // stack trace. diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm index 5ee1bc5..d9e64d9 100644 --- a/content/common/sandbox_mac.mm +++ b/content/common/sandbox_mac.mm @@ -16,6 +16,7 @@ extern "C" { #include "base/basictypes.h" #include "base/command_line.h" #include "base/file_util.h" +#include "base/mac/crash_logging.h" #include "base/mac/mac_util.h" #include "base/rand_util_c.h" #include "base/mac/scoped_cftyperef.h" @@ -559,6 +560,10 @@ bool Sandbox::EnableSandbox(SandboxProcessType sandbox_type, void Sandbox::GetCanonicalSandboxPath(FilePath* path) { int fd = HANDLE_EINTR(open(path->value().c_str(), O_RDONLY)); if (fd < 0) { + base::mac::SetCrashKeyValue( + @"errno", [NSString stringWithFormat:@"%d", errno]); + base::mac::SetCrashKeyValue(@"homedir", NSHomeDirectory()); + PLOG(FATAL) << "GetCanonicalSandboxPath() failed for: " << path->value(); return; |