views:

191

answers:

2

Xcode / objective c does not really print a useful stack trace. My app crashes somewhere, and the damn thing gives me only numbers like 45353453, 34524323, 6745345353, 457634524234. Not useful at all.

So I want to make a NSLog(); on the beginning of EVERY method I have in my entire app. But maybe there's a simpler way to just find out the real stack trace, humanly readable? Not only on app launch or crash, but all the time, on every activity that happens? Would help debugging a lot.

+1  A: 

There really isn't a way to do this reliably from within the app. If your app is crashing and not giving symbols, it sounds like your running a stripped release version and not the debug version?

If you have the unstripped version sitting around, you can correlate between those numbers and the actual name of the stack frame using the atos command (see man atos in Terminal or search for atos in Xcode's documentation or Google).

You probably don't want to log the stack of every method call. The volume of information would quickly become overwhelming. And it shouldn't be a mystery as to why most of the methods in your app are being called (though it will take a while to understand why the interface between UIKit and your app works the way it does).

bbum
+1  A: 

Add a global breakpoint for objc_exception_throw, then you can get a useful stack trace in the debugger.

http://stackoverflow.com/questions/1163981/how-to-add-a-breakpoint-to-objcexceptionthrow

alex_c