打破变量值的变化 [英] Break on a change of variable value

查看:157
本文介绍了打破变量值的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与此处的其他问题类似,喜欢这个



有没有办法打破任何JavaScript调试器中变量值的变化? (比如IE Developer工具,Visual Studio或Firebug)?



我想它就像是一个监视变量,但我希望能够看到callstack和当实际发生对变量的更改时暂停它。



另一种方法可能是使用自定义setter覆盖值设置,并在其中放置断点,但不幸的是这对IE AFAIK不起作用。



UPDATE
看来这种行为至少对于非托管代码是可用的写入C ++ 所以我想也许用C ++编写的javascript引擎(谷歌的V8)可能有类似的东西,但似乎没有我想要的东西。



Object.Watch教程



如果您使用任何一个调试器,我强烈推荐Firebug。对于您的所有Javascript,HTML和CSS需求: - ):



http ://getfirebug.com/javascript


Similar to other questions here, like this one.

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)?

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.

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.

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.

解决方案

You don't even need an IDE - you can use "Object.watch()":

Object.Watch Tutorial

If you use any one debugger, I'd strongly recommend Firebug. For all your Javascript, HTML and CSS needs :-):

http://getfirebug.com/javascript

这篇关于打破变量值的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆