This may be what you are looking for:
http://ejohn.org/blog/javascript-getters-and-setters/
Put a log in the setter and that's it. Of course, I do not know where does this actually work, if it must be trusted code, or any web page, or what.
Based on John Resig's code, I would add to my debug code something like:
var placeLoggerInSetter = function(variableName, obj){ //obj may be window
obj.__defineSetter__(variableName, function(val){
console.log(val); //log whatever here
obj[variableName] = val;
});
}
var something = 0;
placeLoggerInSetter("something", window);
something = 1;
//out goes "1" in the console
something = 2
//out goes "2" in the console
Is that more like it? Again, I did not test it and the obj[variableName] line looks quite recursive to me... will you tell here if it works? :)
Also, with Firebug,
console.dir(obj)
will let you see all the properties of that object in the console, instead of converting it to string as with log(). And also expand the properties and so on. Handy.