javascript调试:有没有办法打破变数值的变化?
与其他问题类似,像这样一个。
有没有办法打破任何javascript调试器中变量值的变化? (像IE Developer工具,Visual Studio或Firebug?)
Is there a way to break on the change of a variable value in any javascript debugger? (like IE Developer tools, Visual Studio, or Firebug?)
我想这是一个像watch variable这样的东西,但是我希望能够看到callstack实际发生变化时暂停它。
I guess it's something like a "watch variable", but I want to be able to see the callstack and pause it when the change to the variable actually occurs.
另一种方法可能是用自定义设置器覆盖值设置,并在其中放置一个断点,但不幸的是这不适用于IE afaik。
An alternative approach might be to override the value setting with a custom setter, and put a breakpoint in that, but unfortunately that won't work for IE afaik.
更新
似乎这种行为至少可用于非托管代码写入C ++ 所以我认为也许一个用C ++编写的JavaScript引擎(Google的V8)可能有类似的东西,但似乎也没有我想要的东西。
UPDATE It appears that this type of behavior is available at least for unmanaged code written in C++ So I thought maybe a javascript engine written in C++ (Google's V8) might have something similar, but that doesn't appear to have what I want either.
您甚至不需要IDE - 您可以使用Object.watch():
You don't even need an IDE - you can use "Object.watch()":
如果您使用任何一个调试器我强烈推荐Firebug。对于您所有的Javascript,HTML和CSS需要: - ):
If you use any one debugger, I'd strongly recommend Firebug. For all your Javascript, HTML and CSS needs :-):