diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/expression_command/call-throws/call-throws.m')
-rw-r--r-- | packages/Python/lldbsuite/test/expression_command/call-throws/call-throws.m | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/expression_command/call-throws/call-throws.m b/packages/Python/lldbsuite/test/expression_command/call-throws/call-throws.m new file mode 100644 index 0000000..a184718 --- /dev/null +++ b/packages/Python/lldbsuite/test/expression_command/call-throws/call-throws.m @@ -0,0 +1,47 @@ +#import <Foundation/Foundation.h> + +@interface MyClass : NSObject +{ +} +- (int) callMeIThrow; +- (int) iCatchMyself; +@end + +@implementation MyClass +- (int) callMeIThrow +{ + NSException *e = [NSException + exceptionWithName:@"JustForTheHeckOfItException" + reason:@"I felt like it" + userInfo:nil]; + @throw e; + return 56; +} + +- (int) iCatchMyself +{ + int return_value = 55; + @try + { + return_value = [self callMeIThrow]; + } + @catch (NSException *e) + { + return_value = 57; + } + return return_value; +} +@end + +int +main () +{ + int return_value; + MyClass *my_class = [[MyClass alloc] init]; + + NSLog (@"I am about to throw."); + + return_value = [my_class iCatchMyself]; + + return return_value; +} |