Search code examples
xcodexcode5breakpointslldbconditional-breakpoint

Breakpoints (linked to a condition) in Xcode


I have read that it is possible to set a conditional breakpoint at some specific line in the code, by setting the breakpoint as usual and then set the condition. That is fine, but what I need now is different. I want my program to stop when a given variable takes a particular value or simply changes its value. But I do not know where this happens. So I need a kind of (general) conditional breakpoint, not one at a specific line. Is this possible? It would be a bit like what is possible with exception breakpoints.


Solution

  • Symbolic breakpoint is what you are looking for. Debug->Breakpoints->Create symbolic breakpoint or follow instructions from apple docs:

    In the bottom-left corner of the breakpoint navigator, click the Add button.

    Choose Add Symbolic Breakpoint.

    Enter the symbol name in the Symbol field.

    If the symbol is declared in more than one library, enter the name of the appropriate library in the Module field.

    To specify that program execution be suspended only if an expression evaluates to true, enter the expression in the Condition field.

    Click Done.

    As symbol i would use setter of property you want to track...