Search code examples
iosxcodedebuggingxcode6conditional-breakpoint

Xcode debugging (breakpoint) issue


I'm writing an iOS app in Objective-C for iOS 8.4 with Xcode 6.4. I have a variable (actually an item in an array) changing in unexpected ways.

In order to find out what is going on, I would like to have a way to make the program pause when a change on the variable is about to happen (or just happened), using some kind of “special break point”.

Is this possible, if YES how?


Solution

  • What you want is a Watchpoint (see "Setting Watchpoints" here).

    Basically they monitor memory for writes and break the program when that happens.

    I think you can only set them from the debugging console, not the Xcode UI, with:

    (lldb) watchpoint set variable myinstancevar
    

    or

    (lldb) w s v myinstancevar