mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
ios: Record NSException.userInfo value.
Add another annotation similar to name and reason for the NSException userInfo string value. Bug: crashpad:31 Change-Id: Ifeda599d7855c1061e5c0f1fb5fe45d568af65f7 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3238128 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
parent
c647c0cb12
commit
9c6a751e4b
@ -128,15 +128,34 @@ crashpad::ObjcExceptionDelegate* g_exception_delegate;
|
||||
objc_exception_preprocessor g_next_preprocessor;
|
||||
NSUncaughtExceptionHandler* g_next_uncaught_exception_handler;
|
||||
|
||||
static void SetNSExceptionAnnotations(id exception,
|
||||
static void SetNSExceptionAnnotations(NSException* exception,
|
||||
std::string& name,
|
||||
std::string& reason) {
|
||||
name = base::SysNSStringToUTF8([exception name]);
|
||||
reason = base::SysNSStringToUTF8([exception reason]);
|
||||
static crashpad::StringAnnotation<256> nameKey("exceptionName");
|
||||
nameKey.Set(name);
|
||||
static crashpad::StringAnnotation<512> reasonKey("exceptionReason");
|
||||
reasonKey.Set(reason);
|
||||
@try {
|
||||
name = base::SysNSStringToUTF8(exception.name);
|
||||
static crashpad::StringAnnotation<256> nameKey("exceptionName");
|
||||
nameKey.Set(name);
|
||||
} @catch (id name_exception) {
|
||||
LOG(ERROR) << "Unable to read uncaught Objective-C exception name.";
|
||||
}
|
||||
|
||||
@try {
|
||||
reason = base::SysNSStringToUTF8(exception.reason);
|
||||
static crashpad::StringAnnotation<512> reasonKey("exceptionReason");
|
||||
reasonKey.Set(reason);
|
||||
} @catch (id reason_exception) {
|
||||
LOG(ERROR) << "Unable to read uncaught Objective-C exception reason.";
|
||||
}
|
||||
|
||||
@try {
|
||||
if (exception.userInfo) {
|
||||
static crashpad::StringAnnotation<512> userInfoKey("exceptionUserInfo");
|
||||
userInfoKey.Set(base::SysNSStringToUTF8(
|
||||
[NSString stringWithFormat:@"%@", exception.userInfo]));
|
||||
}
|
||||
} @catch (id user_info_exception) {
|
||||
LOG(ERROR) << "Unable to read uncaught Objective-C exception user info.";
|
||||
}
|
||||
}
|
||||
|
||||
static void ObjcUncaughtExceptionHandler(NSException* exception) {
|
||||
@ -147,7 +166,6 @@ static void ObjcUncaughtExceptionHandler(NSException* exception) {
|
||||
static crashpad::StringAnnotation<256> nameKey("UncaughtNSException");
|
||||
nameKey.Set("true");
|
||||
std::vector<uint64_t> addresses;
|
||||
NSArray<NSNumber*>* addressArray = [exception callStackReturnAddresses];
|
||||
for (NSNumber* address in addressArray)
|
||||
addresses.push_back([address unsignedLongLongValue]);
|
||||
g_exception_delegate->HandleUncaughtNSException(&addresses[0],
|
||||
|
Loading…
x
Reference in New Issue
Block a user