summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 18:36:33 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 18:36:33 +0000
commit50cdead453a66955b443060b338c7232fe03fc34 (patch)
tree2671dc2884531f3a7b65442eea1eadd9c0a86005 /chrome/common
parente0521140e09b03dca21735082e672e3bbaf908e8 (diff)
downloadchromium_src-50cdead453a66955b443060b338c7232fe03fc34.zip
chromium_src-50cdead453a66955b443060b338c7232fe03fc34.tar.gz
chromium_src-50cdead453a66955b443060b338c7232fe03fc34.tar.bz2
Replace all uses of base/mac/crash_logging.h with base/debug/crash_logging.h.
This also centralizes most crash keys into a constants file. BUG=77656 Review URL: https://codereview.chromium.org/11734011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/crash_keys.cc26
-rw-r--r--chrome/common/crash_keys.h38
-rw-r--r--chrome/common/mac/objc_zombie.mm20
3 files changed, 74 insertions, 10 deletions
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc
new file mode 100644
index 0000000..55b0864
--- /dev/null
+++ b/chrome/common/crash_keys.cc
@@ -0,0 +1,26 @@
+// Copyright (c) 2013 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 "chrome/common/crash_keys.h"
+
+namespace crash_keys {
+
+namespace mac {
+
+const char kFirstNSException[] = "firstexception";
+const char kFirstNSExceptionTrace[] = "firstexception_bt";
+
+const char kLastNSException[] = "lastexception";
+const char kLastNSExceptionTrace[] = "lastexception_bt";
+
+const char kNSException[] = "nsexception";
+
+const char kSendAction[] = "sendaction";
+
+const char kZombie[] = "zombie";
+const char kZombieTrace[] = "zombie_dealloc_bt";
+
+} // namespace mac
+
+} // namespace crash_keys
diff --git a/chrome/common/crash_keys.h b/chrome/common/crash_keys.h
new file mode 100644
index 0000000..34f2589
--- /dev/null
+++ b/chrome/common/crash_keys.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 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 CHROME_COMMON_CRASH_KEYS_H_
+#define CHROME_COMMON_CRASH_KEYS_H_
+
+namespace crash_keys {
+
+// Crash Key Name Constants ////////////////////////////////////////////////////
+
+namespace mac {
+
+// Used to report the first Cocoa/Mac NSException and its backtrace.
+extern const char kFirstNSException[];
+extern const char kFirstNSExceptionTrace[];
+
+// Used to report the last Cocoa/Mac NSException and its backtrace.
+extern const char kLastNSException[];
+extern const char kLastNSExceptionTrace[];
+
+// Records the current NSException as it's being created.
+extern const char kNSException[];
+
+// In the CrApplication, records information about the current event's
+// target-action.
+extern const char kSendAction[];
+
+// Records Cocoa zombie/used-after-freed objects that resulted in a
+// deliberate crash.
+extern const char kZombie[];
+extern const char kZombieTrace[];
+
+} // namespace mac
+
+} // namespace crash_keys
+
+#endif // CHROME_COMMON_CRASH_KEYS_H_
diff --git a/chrome/common/mac/objc_zombie.mm b/chrome/common/mac/objc_zombie.mm
index 0f01a52..a0cd90e 100644
--- a/chrome/common/mac/objc_zombie.mm
+++ b/chrome/common/mac/objc_zombie.mm
@@ -11,14 +11,15 @@
#include <algorithm>
+#include "base/debug/crash_logging.h"
#include "base/debug/stack_trace.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/mac/crash_logging.h"
+#include "base/stringprintf.h"
#include "base/synchronization/lock.h"
+#include "chrome/common/crash_keys.h"
#import "chrome/common/mac/objc_method_swizzle.h"
-
#if !defined(OS_IOS) && (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6)
// Apparently objc/runtime.h doesn't define this with the 10.6 SDK yet.
// The docs say it exists since 10.6 however.
@@ -204,21 +205,20 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) {
}
const char* wasaName = (wasa ? class_getName(wasa) : "<unknown>");
- NSString* aString =
- [NSString stringWithFormat:@"Zombie <%s: %p> received -%s",
- wasaName, object, sel_getName(aSelector)];
+ std::string aString = base::StringPrintf("Zombie <%s: %p> received -%s",
+ wasaName, object, sel_getName(aSelector));
if (viaSelector != NULL) {
const char* viaName = sel_getName(viaSelector);
- aString = [aString stringByAppendingFormat:@" (via -%s)", viaName];
+ base::StringAppendF(&aString, " (via -%s)", viaName);
}
// Set a value for breakpad to report.
- base::mac::SetCrashKeyValue(@"zombie", aString);
+ base::debug::SetCrashKeyValue(crash_keys::mac::kZombie, aString);
// Encode trace into a breakpad key.
if (found) {
- base::mac::SetCrashKeyFromAddresses(
- @"zombie_dealloc_bt", record.trace, record.traceDepth);
+ base::debug::SetCrashKeyFromAddresses(
+ crash_keys::mac::kZombieTrace, record.trace, record.traceDepth);
}
// Log -dealloc backtrace in debug builds then crash with a useful
@@ -228,7 +228,7 @@ void ZombieObjectCrash(id object, SEL aSelector, SEL viaSelector) {
} else {
DLOG(INFO) << "Unable to generate backtrace from -dealloc.";
}
- DLOG(FATAL) << [aString UTF8String];
+ DLOG(FATAL) << aString;
// This is how about:crash is implemented. Using instead of
// |base::debug::BreakDebugger()| or |LOG(FATAL)| to make the top of