Xcode: Symbolic breakpoints pausing app during method execution

Discussion in 'iOS Programming' started by moonman239, Jun 5, 2015.

  1. moonman239, Jun 5, 2015
    Last edited: Jun 6, 2015

    moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    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:
    [​IMG]
     
  2. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #2
    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.
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    How do you do that?
     
  4. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #4
    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:[​IMG]
     

Share This Page