Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: chrome/browser/chrome_application_mac.mm

Issue 275008: [Mac] Log some NSException info with crash dumps. (Closed)
Patch Set: obviously better to have merged this way. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_application_mac.mm
diff --git a/chrome/browser/chrome_application_mac.mm b/chrome/browser/chrome_application_mac.mm
index 86c6c4a47066a3f12d47929ab7f249ec1960e15a..aece9a0bdba395179933ea77530e233a5c1acc64 100644
--- a/chrome/browser/chrome_application_mac.mm
+++ b/chrome/browser/chrome_application_mac.mm
@@ -196,6 +196,35 @@ class ScopedCrashKey {
if (!reportingException) {
reportingException = YES;
CrApplicationNSException::RecordExceptionWithUma(anException);
+
+ // Store some human-readable information in breakpad keys in case
+ // there is a crash. Since breakpad does not provide infinite
+ // storage, we track two exceptions. The first exception thrown
+ // is tracked because it may be the one which caused the system to
+ // go off the rails. The last exception thrown is tracked because
+ // it may be the one most directly associated with the crash.
+ static const NSString* kFirstExceptionKey = @"firstexception";
+ static BOOL trackedFirstException = NO;
+ static const NSString* kLastExceptionKey = @"lastexception";
+
+ // TODO(shess): It would be useful to post some stacktrace info
+ // from the exception.
+ // 10.6 has -[NSException callStackSymbols]
+ // 10.5 has -[NSException callStackReturnAddresses]
+ // 10.5 has backtrace_symbols().
+ // I've tried to combine the latter two, but got nothing useful.
+ // The addresses are right, though, maybe we could train the crash
+ // server to decode them for us.
+
+ NSString* value = [NSString stringWithFormat:@"%@ reason %@",
+ [anException name], [anException reason]];
+ if (!trackedFirstException) {
+ SetCrashKeyValue(kFirstExceptionKey, value);
+ trackedFirstException = YES;
+ } else {
+ SetCrashKeyValue(kLastExceptionKey, value);
+ }
+
reportingException = NO;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698