| Index: ios/chrome/browser/crash_report/breakpad_helper.mm
|
| diff --git a/ios/chrome/browser/crash_report/breakpad_helper.mm b/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| index 252df3da7c5b61499a37109909f392706885147d..3effb5d48f103612e3be6c4e16d0cabb2da31b91 100644
|
| --- a/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| +++ b/ios/chrome/browser/crash_report/breakpad_helper.mm
|
| @@ -78,11 +78,10 @@ void ClearCrashKeyValueImpl(const base::StringPiece& key) {
|
| RemoveReportParameter(base::SysUTF8ToNSString(key.as_string()));
|
| }
|
|
|
| -// Callback for logging::SetLogMessageHandler
|
| +// Callback for logging::AddLogMessageHandler
|
| bool FatalMessageHandler(int severity,
|
| - const char* file,
|
| + const std::string& file,
|
| int line,
|
| - size_t message_start,
|
| const std::string& str) {
|
| // Do not handle non-FATAL.
|
| if (severity != logging::LOG_FATAL)
|
| @@ -99,15 +98,16 @@ bool FatalMessageHandler(int severity,
|
| 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];
|
| + NSString* fatal_value =
|
| + [NSString stringWithFormat:@"%s:%d: %s", file.substr(last_slash).c_str(),
|
| + line, str.c_str()];
|
| AddReportParameter(fatal_key, fatal_value, true);
|
|
|
| // Rather than including the code to force the crash here, allow the
|
| @@ -130,7 +130,7 @@ void Start(const std::string& channel_name) {
|
| [[BreakpadController sharedInstance] start:YES];
|
| base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
|
| &ClearCrashKeyValueImpl);
|
| - logging::SetLogMessageHandler(&FatalMessageHandler);
|
| + logging::AddLogMessageHandler(&FatalMessageHandler);
|
| g_crash_reporter_enabled = true;
|
| // Register channel information.
|
| if (channel_name.length()) {
|
|
|