Xcode and iOS 5: Bringing back backtrace symbols

Xcode and iOS 5: Bringing back backtrace symbols

If you have downloaded iOS 5, you will have aundoubtedly noticed that there is something important missing about the new SDK: the stack trace printed from each exception. You now see hexadecimal representations of symbols where you previewsly saw full human-readable symbols.

Apple is undergoing changes in the low-level foundation of iOS and the Xcode debugger, which is now officially LLDB. My guess is that Apple has still some issues with reporting errors, but fortunatly, this issue is easy to solve.

Open your Xcode project, and switch to the breakpoints tab. On the bottom left, you will see a ‘+’ button that when pressed, displays 2 options:

breakpoint-create

You need the “Add Exception Breakpoint” option. This will add an exception breakpoint to your Xcode project

By default, it will revert to ‘All’ as the exception to catch and edit. Set the action to ‘Debugger Command’ if it’s not already selected, and set the empty text field to ‘bt’, which is the command which prints the current stacktrace on the current thread.

There now, when you have an unhandled exception thrown, your debugger will show you a nice backtrace and a reason for throwing the Exception!