views:

78

answers:

3

Example: I run my app in the simulator. Then I want to figure out what exactly is going on when I touch a button. Normally I would first have to find out where the entry-point of all this madness is in order to place a breakpoint. But now lets assume my app has 700 classes and it's incredibly complex, with more than 12.000 methods. Chances are big I don't know at all where to put the breakpoint. Just in theory.

How can I make the debugger stop anywhere the next time something happens? I know I can switch it on/off while my app is running, which is fine, but is there a way to make it behave like if every line in the app had a breakpoint on it? Hope you know what I mean. My english is horrible. Thank you.

+2  A: 

What you need are symbolic breakpoints. For a brief explanation look here.

Kai
Thanks for that link, but I really want to stop *anywhere*, not just on exceptions. As soon as I enable debugging I want that the next method or function which gets called is a "breakpoint" automatically. Hard to explain...
Another Registered User
Symbolic breakpoints don't just stop on exceptions, it's just that exceptions are commonly used in the examples. You can use any method of any class as a symbolic breakpoint.
TechZen
+1  A: 

...is there a way to make it behave like if every line in the app had a breakpoint on it?

It sounds like you're asking about the "step over" command. You set a single breakpoint so the app stops at a particular line. Then you can use the "step over" command to move over each subsequent line of code. This lets you watch each line execute in detail.

You can't run the entire app line by line because the debugger has to logically follow every command including those from the compiled libraries. If you tried to follow every command from launch it would take you several hours of wading through assembly just to get to the initial view.

TechZen
+2  A: 

I am not sure if your requested technique is really usable in practice, but adding symbolic breakpoints on -[UIApplication sendEvent:] and/or -[UIApplication sendAction:to:from:forEvent:] will at least break when an event is triggered / an action is performed instead of trying to step through every line.

When it breaks, you can continue with the "step over" command as described in the other answer to find the relevant code sections. You can play around with other breakpoints that might come closer to what you are looking for.

Rhult