Newbie question - watching variables

Ned Konz ned at bike-nomad.com
Sat Aug 25 01:06:33 UTC 2001


On Friday 24 August 2001 11:58 am, Kyle Bygott wrote:
> Is there some way to set a watch on a variable such that when something
> attempts to change the variable it halts and lets you see whats going on? 
> I've got something changing a variable somewhere in my code but can't track
> it down for the life of me.  Any features like this would help immensely. 
> Thanks, Kyle Bygott

Depends on where the variable is. If it's an instance variable, just abstract 
all the places where it's set (i.e. do a method call to set it instead of 
referring to it directly) and insert a "self halt" inside the setter 
(possibly within a conditional). Or put in "self halts" next to where the 
variable gets set in the suspect methods.

There may be a way to do this with the InterpreterSimulator (i.e. check the 
variable for changes in between steps); I don't know for sure.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list