如何检测变量何时更改值 [英] How to detect when a variable changes value
本文介绍了如何检测变量何时更改值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何轻松检测变量何时更改值?每当指定的变量改变值时,我希望程序的执行中断调试器。现在我正在使用Eclipse的调试器。
How can I easily detect when a variable changes value? I would like the execution of the program to break on the debugger whenever a specified variable changes value. Right now I'm using Eclipse's debugger.
推荐答案
对于类或实例变量
- 右键单击大纲视图中的变量
- 选择切换观察点
- 然后,在breapkoints视图中,您可以正确点击生成的
条目 - 选择断点属性
- 取消选择现场访问。
- right-click on the variable in the outline view
- select "Toggle Watchpoint"
- Then, in the breapkoints view, you can right-click on the resulting entry
- select "breakpoint properties"
- deselect "Field Access".
这篇关于如何检测变量何时更改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文