Mohammed
Mohammed

Reputation: 334

how to trace program execution in xcode?

I want to know how i can trace program execution using xcode I want to know which method being called right now as when you add break point in method

Is there any way to do such alike thing without adding breakpoints??

Upvotes: 2

Views: 1468

Answers (3)

Mohammed
Mohammed

Reputation: 334

after search i found that the easiest solution is to put the following code in your methods:

NSLog(@"<%@:%@:%d>", NSStringFromClass([self class]), NSStringFromSelector(_cmd), __LINE__);

Upvotes: 1

trojanfoe
trojanfoe

Reputation: 122381

There are a couple of Debugger-related WWDC 2012 videos, one of which shows you how to add a breakpoint that continues automatically after running a debugger command. This is preferred to adding logging as there is no need to keep doing the write-compile-debug loop.

You can add an action to the breakpoint that calls:

expr (void)NSLog(@"self=%p Method1", self);

Having said that I still use log calls, but I use my own logging framework which prints the name of the class and method automatically (using __FUNCTION__ string generated by the compiler).

Upvotes: 1

clement
clement

Reputation: 4266

NSLog(@"Check 1 - 2 !");

will show you a log trace ;-)

Upvotes: 0

Related Questions