groups

name language licence
NSTreeNode indexPathOfNodeWithRepresentedObject Objective-C MIT
Convert a number to text Perl MIT
Exact Table Cell Value Double-Clicked (through Bindings) Objective-C Other
Animating Progress Indicator in Menu Objective-C Other
NSDate Additions for Time Intervals since System Startup Objective-C Other
Pop Contextual Menu on standard button mouseDown: Objective-C Other
watchpoint for properties Other Other
NSObject executeAfterDelay:handler: Objective-C MIT

< 1 2 3 4 >



language: Other
licence: Other

watchpoint for properties

options: view full snippetsend to code collector
From: Jim Ingham <jingham@apple.com>

@synthesized properties sometimes define setters & getters, though not always.  If they do, the setter will have the form (for property "propName"):

-[ClassName setPropName:]

If it is there you can break on it.  "obj.propName = foo" seems to always get translated to a call to the setter if it exists.  Of course if you've renamed the setter, then it will be whatever you've called it.

However, it looks like sometimes the compiler decides it doesn't need to define a setter.  In that case, if you know what the backing ivar is, you can try watching that.  Watchpoints work pretty well on x86 Macs - where we have access to the hardware watchpoint registers.  The don't work so well on PPC.  Note also there are only 4 watchpoint registers on the x86 chips, so you can usefully watch 4 variables, and after that we have to fall back to software watchpoints, which are very slow.

If you're on Xcode 2.5 or 3.0, we've added a convenient bit to the watch command:

(gdb) watch -location obj->propName

will watch the location where propName is stored directly.  Otherwise:
	
(Continues...)