views:

196

answers:

3

So I have a rather complex application that I've, perhaps naively, agreed to "debug". Upon entering into a certain method, I'd like to print out as much info about who called the method, from which class, method, etc. it was called from. Any suggestions would be very much appreciated!!

A: 

For debugging you could use a debugger :) put a breakpoint in the method and view the backtrace.

You could also scatter NSLog statements with relevant information in methods.

Ciarán Walsh
+3  A: 

Have a look at this blog post about getting the stack trace. Think you should be able to distill what you need from it.

epatel
very nice! thanks!
ennuikiller
Hey, I recognize that site!
Tom
+1  A: 

I answered a similar question; different only in that the other questioner was trying to log the caller from within code.

You might find it interesting:

http://stackoverflow.com/questions/1793999/how-to-find-out-who-called-a-method/1794051#1794051

bbum