Debugging Goodness – Watchpoints

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.

Magic!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s