Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to Track/trace and log all the methods, by Class and Method name, during a debug session?

I am not interested in logging into frameworks or under the covers but only at my source level code upon entry and exit of each method. I would like it to provide Class Name and Method Name and log it to file or at least have it fly by on the screen.

My query is if it is possible with existing Xcode/Debugger/Instruments facilities, can I implement it in an easy way other than an NSLog statement at every method entry and exit, or is there a commercial tool that provides this capability ?

I'm talking source methods here... not execution processes or threads. Thanks.

like image 260
Ric Avatar asked Jul 30 '11 22:07

Ric


People also ask

How do I trace debugging?

You can enable debugging or tracing by adding a #define DEBUG or #define TRACE line to the top of your code or using the /d:DEBUG or /d:TRACE compiler switch when you compile. See the example in Listing 21.7.

What is trace in C#?

Tracing helps to see the information of issues at the runtime of the application. By default Tracing is disabled. Tracing has the following important features: We can see the execution path of the page and application using the debug statement. We can access and manipulate trace messages programmatically.


1 Answers

Dave Dribin covers precisely this in his article Tracing Objective-C messages.

The part you are after is probably this:

If you set the NSObjCMessageLoggingEnabled environment variable to YES, the Objective-C runtime will log all dispatched Objective-C messages to a file named /tmp/msgSends-<pid>.

like image 94
Sedate Alien Avatar answered Nov 15 '22 21:11

Sedate Alien