Often when debugging, it’s important for me to know what methods of a class are being called in what order. The naive solution (that I’ve been using thus far) is to pop an NSLog at the top of each method. But this is time consuming, repetitive, ugly, and makes my code look juvenile if I forget to remove the logs after debugging.
A cleaner solution is to set breakpoints on each of my methods, configure their actions to issue the debugger command: po NSStringFromSelector(_cmd) and set them to automatically continue. This is prettier and saves me from having to remember to remove all those NSLogs, but is no less repetitive or time consuming.
What I really want is a way to set a symbolic breakpoint that breaks on every method (of a class? Of a module?). Any debugging/runtime masters have a solution or tips on where to start looking?
All Objective-C method calls go through one of the C runtime calls
objc_msgSend,objc_msgSend_stret,objc_msgSendSuperandobjc_msgSendSuper_stretper the ‘Sending Messages’ section of the Objective-C Runtime Reference. So you should be able to trap those, and give them actions to log the relevant parts of the first two parameters (it’s target and selector for the normal sends, a struct describing the superclass that contains both the target and the class type for super calls).