views:

137

answers:

3

XCode:Run>Show>Breakpoints

I've added the obligatory [NSExceptionRaise] and objc_exception_throw yet when I close the Breakpoints window and then return XCode adds a third breakpoint: -[NSExceptionRaise]. Does this mean [NSExceptionRaise] is wrong and I should delete it? Or are they both helpful? If so in what way are they functionally different?

alt text

+2  A: 

The correct breakpoint is:

-[NSException raise]

You're instructing the debugger to break on the -raise method of the NSException class. "[NSExceptionRaise]" is (meaning no disrespect) nonsense. :-)

You don't need both, as far as I know. objc_exception_throw is the "new" way, whereas -[NSException raise] is the "old" way. I believe if you're on Leopard or later, only objc_exception_throw will be called. 10.4 or prior will call -[NSException raise].

Joshua Nozzi
can anyone verify that 10.5+ *only* calls **objc_exception_throw**? if so i can forget about this [NSException raise] nonsense entirely.
Meltemi
As of 10.5, -[NSException raise] calls objc_exception_throw. This is why you don't need both.
Ken
A: 

The newly added breakpoint is to -[NSException raise], which is distinct from [NSExceptionRaise] in that the latter is an object method (NSException being the class, raise being the message). I don't know what the latter is, and I suspect XCode is trying to be intelligent about what you entered v. what it thinks you meant.

fbrereto
A: 

You have to preface the method with either a plus or minus character because the debugger uses the headers to locate and define the symbol. Different methods can have the same name but methods prefaced by a "+" are class methods and those prefaced by "-" are instance methods. Without the plus or minus the debugger has no idea what method you wanted.

TechZen