Debugging app exceptions crashes in XCode 4

Sometimes… no wait, most of the times, your Objective-C application will crash with something like:

Terminating app due to uncaught exception

And proceeding to show you a quite useless series of memory addresses like this:

Xcode 4 debug console showing exception throw call stack

You could try to inspect those addresses with GDB using:

info symbol <0xaddress>

But the informations you will receive are as useless as the Xcode back trace.

Fear not! Here is the solution: go in the break point navigator and add an exception breakpoint like so:

Xcode 4 menu to add an exception breakpoint

You’ll be presented with a popover that you can just leave as it is:

Xcode 4 new exception breakpoint popover

And done! Now every exception will trigger a breakpoint exactly where it’s being thrown. This saved me from endless debugging pain, I hope it can come handy to someone else.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>