Just learned a handy little feature in Xcode 4.4+ with respect to the debugger. I always knew about them, heard about them, but never really used them. Until today. When I saw its face… I’m a believer!
Watchpoints! (original post here)
Watchpoints are for when you want to know when a variable is being changed, and more importantly what/who is trying to change it.
You use them simply by I’d say setting a breakpoint somewhere where you want to set the watchpoint (for example when the variable is instantiated), then at the debugger, you can type
(lldb) watchpoint set variable _myVariable
The first 3 words are syntax, the 4th is your distinct variable.
After that it will break when this is being assigned another value.