iOS Xcode: Symbolic breakpoints pausing app during method execution

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
I am trying to debug an application I'm building. This bug appears to be causing one of my methods to fire prematurely, and I'd like to know why. So, I'll use a breakpoint. I want the debugger to stop at the very line where that method is invoked.

Suppose, for example, that I have a class with just three methods, defined as follows:

Code:
-(void)methodThatWorks
{
// do something productive
}

-(void)someMethod
{
if (X)
{
[self methodThatWorks];
}
}
-(void)someOtherMethod
{
if (Y)
{
[self methodThatWorks];
}
}
If someMethod causes methodThatWorks to be invoked, I want the program to stop execution at the [self methodThatWorks] line in someMethod. Likewise, if someOtherMethod causes methodThatWorks to be invoked, I want the program to stop execution at the [self methodThatWorks] line in someOtherMethod.

I thought setting a symbolic breakpoint would do the trick, but what really happens is the debugger puts the breakpoint in the method that is called.

Edit: Here's a screenshot to illustrate what's happening. Note that this screenshot is not from the app I'm building - it's from a project I just built today:
 
Last edited:

mfram

macrumors 65816
Jan 23, 2010
1,064
142
San Diego, CA USA
Put a breakpoint in the first line of methodThatWorks, then change your context in the debugger up a level in the call stack when the breakpoint hits.
 

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,524
22
Update: Apparently, what you see in the screenshot is exactly what Apple wanted the symbolic breakpoint to do. However, there is a way to see the line of code in which a method was invoked while your app is paused by a breakpoint in that method. In the Debug Navigator, in the stack trace, will be the name of the method that caused the aforementioned method to fire. Click on it, and Xcode will highlight the line in which the method the breakpoint fired in is invoked. Here's a screenshot, from this related Apple Support Communities thread:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.