Index: components/crash/content/app/breakpad_mac.mm |
diff --git a/components/crash/content/app/breakpad_mac.mm b/components/crash/content/app/breakpad_mac.mm |
index d7ab1ae6389a1a36759d3b637a767d33f13a188d..36d25b204abd955cb19ecac5276c9bfbadd3b509 100644 |
--- a/components/crash/content/app/breakpad_mac.mm |
+++ b/components/crash/content/app/breakpad_mac.mm |
@@ -73,8 +73,8 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) { |
} |
} |
-bool FatalMessageHandler(int severity, const char* file, int line, |
- size_t message_start, const std::string& str) { |
+bool FatalMessageHandler(int severity, const std::string&, int line, |
+ const std::string& str) { |
// Do not handle non-FATAL. |
if (severity != logging::LOG_FATAL) |
return false; |
@@ -90,16 +90,17 @@ bool FatalMessageHandler(int severity, const char* file, int line, |
base::AutoReset<bool> guard(&guarded, true); |
// Only log last path component. This matches logging.cc. |
- if (file) { |
- const char* slash = strrchr(file, '/'); |
- if (slash) |
- file = slash + 1; |
- } |
+ size_t last_slash = file.rfind('/'); |
+ if (last_slash == file.npos) |
+ last_slash = 0; |
+ else |
+ last_slash++; |
NSString* fatal_key = @"LOG_FATAL"; |
NSString* fatal_value = |
[NSString stringWithFormat:@"%s:%d: %s", |
- file, line, str.c_str() + message_start]; |
+ file.substr(last_slash).c_str(), line, |
+ str.c_str()]; |
SetCrashKeyValue(fatal_key, fatal_value); |
// Rather than including the code to force the crash here, allow the |
@@ -264,7 +265,7 @@ void InitCrashReporter(const std::string& process_type) { |
SetCrashKeyValue(@"prod", [info_dictionary objectForKey:@BREAKPAD_PRODUCT]); |
SetCrashKeyValue(@"plat", @"OS X"); |
- logging::SetLogMessageHandler(&FatalMessageHandler); |
+ logging::AddLogMessageHandler(&FatalMessageHandler); |
base::debug::SetDumpWithoutCrashingFunction(&DumpHelper::DumpWithoutCrashing); |
// abort() sends SIGABRT, which breakpad does not intercept. |