Skip to content

Commit

Permalink
Added a button on test app to raise an exception from NSApplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyashumihin committed Dec 10, 2019
1 parent a033117 commit 2484b5f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CrashLib/CrashLib.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
78FBB4A8239FAD0100ADFA1F /* MSCrashNSApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 78FBB4A6239FAD0000ADFA1F /* MSCrashNSApp.h */; };
78FBB4A9239FAD0100ADFA1F /* MSCrashNSApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 78FBB4A7239FAD0100ADFA1F /* MSCrashNSApp.m */; };
801C25311F04001300F4859B /* CrashLib-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = B24187A21DD2A7F900D820D8 /* CrashLib-Bridging-Header.h */; settings = {ATTRIBUTES = (Public, ); }; };
8065B5801F4C4024004FF622 /* CrashLib.h in Headers */ = {isa = PBXBuildFile; fileRef = B24187B61DD2A7F900D820D8 /* CrashLib.h */; settings = {ATTRIBUTES = (Public, ); }; };
8065B5811F4C4024004FF622 /* MSCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = B24187891DD2A7F900D820D8 /* MSCrash.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -166,6 +168,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
78FBB4A6239FAD0000ADFA1F /* MSCrashNSApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSCrashNSApp.h; sourceTree = "<group>"; };
78FBB4A7239FAD0100ADFA1F /* MSCrashNSApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSCrashNSApp.m; sourceTree = "<group>"; };
8065B5781F4C3FF4004FF622 /* CrashLibMac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CrashLibMac.framework; sourceTree = BUILT_PRODUCTS_DIR; };
80F991211F0265070040FAD7 /* CrashLibTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CrashLibTV.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9CD0C47B228A27EE00B14FCA /* CrashLib Release iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "CrashLib Release iOS.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -286,6 +290,8 @@
B24187971DD2A7F900D820D8 /* MSCrash.m */,
B241878D1DD2A7F900D820D8 /* MSCrashAbort.h */,
B241879B1DD2A7F900D820D8 /* MSCrashAbort.m */,
78FBB4A6239FAD0000ADFA1F /* MSCrashNSApp.h */,
78FBB4A7239FAD0100ADFA1F /* MSCrashNSApp.m */,
B24187B81DD2A7F900D820D8 /* MSCrashAsyncSafeThread.h */,
B24187B31DD2A7F900D820D8 /* MSCrashAsyncSafeThread.m */,
B24187A81DD2A7F900D820D8 /* MSCrashCorruptMalloc.h */,
Expand Down Expand Up @@ -362,6 +368,7 @@
8065B59B1F4C4024004FF622 /* MSCrashOverwriteLinkRegister.h in Headers */,
8065B5AC1F4C4024004FF622 /* MSCrashUndefInst.h in Headers */,
8065B5911F4C4024004FF622 /* MSCrashFramelessDWARF.h in Headers */,
78FBB4A8239FAD0100ADFA1F /* MSCrashNSApp.h in Headers */,
8065B5851F4C4024004FF622 /* MSCrashAsyncSafeThread.h in Headers */,
8065B5871F4C4024004FF622 /* MSCrashCXXException.h in Headers */,
8065B58B1F4C4024004FF622 /* MSCrashCorruptObjC.h in Headers */,
Expand Down Expand Up @@ -661,6 +668,7 @@
8065B5981F4C4024004FF622 /* MSCrashObjCException.m in Sources */,
8065B5AE1F4C4024004FF622 /* MSFramelessDWARF_i386.s in Sources */,
8065B5901F4C4024004FF622 /* MSCrashNSLog.m in Sources */,
78FBB4A9239FAD0100ADFA1F /* MSCrashNSApp.m in Sources */,
8065B59A1F4C4024004FF622 /* MSCrashObjCMsgSend.m in Sources */,
8065B59C1F4C4024004FF622 /* MSCrashOverwriteLinkRegister.m in Sources */,
8065B59E1F4C4024004FF622 /* MSCrashPrivInst.m in Sources */,
Expand Down
8 changes: 8 additions & 0 deletions CrashLib/CrashLib/MSCrashNSApp.h
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#import "MSCrash.h"

@interface MSCrashNSApp : MSCrash

@end
32 changes: 32 additions & 0 deletions CrashLib/CrashLib/MSCrashNSApp.m
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#import "MSCrashNSApp.h"

@implementation MSCrashNSApp

- (NSString *)category {
return @"Exceptions";
}

- (NSString *)title {
return @"Throw Objective-C exception avoiding send event";
}

- (NSString *)desc {
return @""
"Throw an uncaught Objective-C exception avoiding send event. "
"It's possible to generate a better crash report here compared to the C++ Exception case "
"because NSUncaughtExceptionHandler can be used, which isn't available for C++ extensions.";
}

- (void)crash {
[self performSelector:@selector(delayedException) withObject:nil afterDelay:0.1];
}

- (void)delayedException {
@throw [NSException exceptionWithName:NSGenericException reason:@"An uncaught exception! SCREAM."
userInfo:@{NSLocalizedDescriptionKey: @"I'm in your program, catching your exceptions!"}];
}

@end

0 comments on commit 2484b5f

Please sign in to comment.