Debbuging trick for Xcode

Wednesday, November 19th, 2008 | Programming

If you make an error which throws an exception, its sometimes quite hard to trance the error. Usually you have to set a breakpoint and step thru the code to find the line which throws the exception.

Woudn’t it be better, if the debugger stops automatically at the line of code, which throws the exception? I say yes, such things can make life easier and it is possible, since Xcode provides a feature called symbolic breakpoints.
To achieve this behaviour go to Build/Manage breakpoints/Add symbolic breakpoint and enter objc_exception_throw
Now create a programmatical error in your code (e.g. try to get an object in a NSArray with a non existing index) and start the debugger (Apple + Y). The debugger will stop exactly on the line of code, where the exception has been thrown.

Tags: , , ,

3 Comments to Debbuging trick for Xcode

RYErnest
December 1, 2008

Nice post u have here :D Added to my RSS reader

Olechka-persik
December 10, 2008

Thanks for post. Nice to see such good ideas.

lehmamic
December 15, 2008

Than you for the nice commend :)

Leave a comment