See objc calls in the call stack

I am debugging an Objective-C application and want to see method calls in the ObjC library (for educational purposes!). What is the best way to do this?

+1
source share
1 answer
// print a stacktrace NSLog(@"%@", [NSThread callStackSymbols]); // requires iOS 4 

or

 // print stacktrace using C functions #import <execinfo.h> #import <unistd.h> void PrintStackTrace() { void *stackAdresses[32]; int stackSize = backtrace(stackAdresses, 32); backtrace_symbols_fd(stackAdresses, stackSize, STDOUT_FILENO); } 

either set a breakpoint in Xcode to pause execution, and then type GDB commands in the console, or just look at the stack in the debug navigator tab.

+4
source

All Articles