Skip navigation.
 
mlWill a breakpoint on objc_exception_throw stop on @throw?
FROM : Scott Ellsworth
DATE : Wed Jul 12 00:04:38 2006

Flushed with the success of the CFZombieLevel discussion, I am 
curious about the second issue raised.

Are people using objective C exceptions, and is the debugger stopping 
on them for you?

I use the following code:

   NSLog(@"Throwing exception");
   NSException *badness = [NSException 
exceptionWithName:@"ThrownException"
                                      reason:@"Threw an exception"
                                    userInfo:nil];
   
    @throw badness;

I have a breakpoint set on objc_exception_throw() - the raise is 
somewhere outside my own code.

#0    0x9275c1e1 in -[NSException raise]
#1    0x934c2d87 in -[NSControl mouseDown:]
#2    0x934804b7 in -[NSWindow sendEvent:]
#3    0x93472524 in -[NSApplication sendEvent:]
#4    0x9339d106 in -[NSApplication run]
#5    0x93391037 in NSApplicationMain
#6    0x0000285c in main at main.m:13

This seems like it would be hard to find the actual exception, save 
by a string search of the code.

(NB - I did google on this, and did not find a lot of discussion 
either way.)

Scott

Related mailsAuthorDate
mlWill a breakpoint on objc_exception_throw stop on @throw? Scott Ellsworth Jul 12, 00:04
mlRe: Will a breakpoint on objc_exception_throw stop on @throw? Chris Suter Jul 12, 00:16
mlRe: Will a breakpoint on objc_exception_throw stop on @throw? Scott Ellsworth Jul 12, 00:35