| Index: base/mac/crash_logging.mm
|
| diff --git a/base/mac/crash_logging.mm b/base/mac/crash_logging.mm
|
| index ce0db392a8239c9b991a9db35395fb1a81d6dfd2..89f5fba894d6ce7a06d7ffa3541afaca65057cd4 100644
|
| --- a/base/mac/crash_logging.mm
|
| +++ b/base/mac/crash_logging.mm
|
| @@ -6,6 +6,8 @@
|
|
|
| #import <Foundation/Foundation.h>
|
|
|
| +#include "base/logging.h"
|
| +
|
| namespace base {
|
| namespace mac {
|
|
|
| @@ -28,6 +30,30 @@ void ClearCrashKey(NSString* key) {
|
| g_clear_key_func(key);
|
| }
|
|
|
| +void SetCrashKeyFromAddresses(NSString* key,
|
| + const void* const* addresses,
|
| + size_t count) {
|
| + NSString* value = @"<null>";
|
| + if (addresses && count) {
|
| + const size_t kBreakpadValueMax = 255;
|
| +
|
| + NSMutableArray* hexBacktrace = [NSMutableArray arrayWithCapacity:count];
|
| + size_t length = 0;
|
| + for (size_t i = 0; i < count; ++i) {
|
| + NSString* s = [NSString stringWithFormat:@"%p", addresses[i]];
|
| + length += 1 + [s length];
|
| + if (length > kBreakpadValueMax)
|
| + break;
|
| + [hexBacktrace addObject:s];
|
| + }
|
| + value = [hexBacktrace componentsJoinedByString:@" "];
|
| +
|
| + // Warn someone if this exceeds the breakpad limits.
|
| + DCHECK_LE(strlen([value UTF8String]), kBreakpadValueMax);
|
| + }
|
| + base::mac::SetCrashKeyValue(key, value);
|
| +}
|
| +
|
| ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value)
|
| : crash_key_([key retain]) {
|
| if (g_set_key_func)
|
|
|