There have been posts about how to use exception breakpoint in Xcode. But my question is what exactly that is? It seems that I get a much complete stack trace when I enable exception breakpoint for all exceptions. Why is that so? Also I don't get error messages anymore. I am just really curious about how exception break points work. Thanks
It's just a GUI wrapper around setting a symbolic breakpoint on objc_exception_throw.
objc_exception_throw is just a C function that is used to raise all exceptions. So it's just like breaking on any function.
You don't get log messages any more because the debugger stops when the exception is thrown. If you continue from there, the exception will eventually be handled by the application which logs it by default. If you don't continue, though, you won't get any logs.
There's a Wikipedia article on breakpoints.
Xcode is just offering a GUI to use the standard debugger, gdb. So you might also want to read up on debuggers, and gdb.
Because developers often have no idea where a bug is hiding in your program, sometimes you wish that Xcode would tell you which line of code is causing an uncaught exception that results in a crash. This is when exception breakpoints are helpful.
To add one, open the breakpoint navigator and click on the + in the lower-left corner of the window. From the contextual menu, select Exception Breakpoint. A new exception breakpoint is created and a pop-up appears. Set it so that it catches all exceptions on throw.
Now when your app throws an exception, Xcode will take you to the line that directly causes the exception to be raised.
As you pointed out however, it won't log details about the exception to the console yet. This is because the application has not crashed yet. To see the crash and any related console message, continue program execution in the debug bar until you see the crash.
Source: iOS Programming: The Big Nerd Ranch Guide, 6th Edition
来源:https://stackoverflow.com/questions/10162664/what-is-an-exception-breakpoint-in-xcode
