Files
clang-p2996/lldb/test/API/macosx/objc_exception_recognizer/main.m
Jim Ingham f79c037b63 Fix the check in StopInfoBreakpoint for "are we currently running an expression"
We were checking "WasTheLastResumeForUserExpression" but that returns true even
if that expression was completed, provided we haven't run again.  This uses a
better check.

This is actually fairly hard to trigger.  It happens the first time you hit an
objc_exception_throw breakpoint and invoke that frame recognizer for that.  But
I couldn't trigger it using a Python based frame recognizer.  So I wrote a test
for the objc_exception_throw_breakpoint recognizer which should have been there
anyway...  It fails (the target auto-continues) w/o this patch and succeeds with
it.

Differential Revision: https://reviews.llvm.org/D147587
2023-04-05 17:14:25 -07:00

38 lines
817 B
Objective-C

#import <Foundation/Foundation.h>
@interface MyException : NSException
{
int extra_info;
}
- (NSException *) initWithExtraInfo: (int) info;
@end
@implementation MyException
- (NSException *) initWithExtraInfo: (int) info
{
[super initWithName: @"NSException" reason: @"Simple Reason" userInfo: nil];
self->extra_info = info;
return self;
}
@end
int
main(int argc, char **argv)
{
// Set a breakpoint here for plain exception:
@try {
NSException *plain_exc = [[NSException alloc] initWithName: @"NSException" reason: @"Simple Reason" userInfo: nil];
[plain_exc raise];
}
@catch (id anException) {}
// Set a breakpoint here for MyException:
@try {
MyException *my_exc = [[MyException alloc] initWithExtraInfo: 100];
[my_exc raise];
}
@catch (id anException) {}
return 0;
}