Nat
Nat

Reputation: 12948

Xcode stops few lines after breakpoint position

I have following code:

- (void)myFunction {                      // line 1
    if (self.myProperty) {                // line 2
        return; // BREAKPOINT IS SET HERE // line 3
    }                                     // line 4
    self.myProperty = 10;                 // line 5
}

Taking upon consideration, my breakpoint is on return statement, I'd expect the code to stop if it enters that line. Instead, I can see debugger stop at line 5. How is that possible? How to turn it off? I want it to stop only if it evaluates line 3 (after which it can't continue to line 5).

I don't have any other breakpoints set in code at the moment. (There are no exception breakpoints nor anything like that.)

Xcode 6.1.1

Upvotes: 1

Views: 342

Answers (2)

Nat
Nat

Reputation: 12948

Forgot I've changed build configuration to Release ;). After setting it to Debug everything is fine.

Upvotes: 3

ButtahNBred
ButtahNBred

Reputation: 470

Maybe place a breakpoint at line 2 to evaluate the contents of the conditional. If self.myProperty has the value 0 it will always skip the return statement since 0 is equivalent to false. Check to make sure self.myProperty has a different value or make your conditional more specific.

Upvotes: 0

Related Questions