Quantcast
Channel: A Tasty Pixel » Blog » Mac
Viewing all articles
Browse latest Browse all 15

iPhone debugging tip: Breaking on exceptions and reading their content

$
0
0

Just a quick one: This may be obvious to many devs, but it’s worth noting. One common and useful debugging technique is breaking on exceptions, so that you can see exactly where in your app’s flow a breakpoint occurs.

This can be done by adding -[NSException raise] and objc_exception_throw to your breakpoints list.

Once an exception happens, you can then check out the exception itself to see what went wrong. The approach varies between platforms. If you’re in the simulator (or any Mac OS X app running on Intel), the exception will be stored in the $eax register. Take a look by typing:

po $eax

If you’re on the iPhone, it’ll be $r0, so:

po $r0


Viewing all articles
Browse latest Browse all 15

Trending Articles