java/eclipse中的数据断点
当使用 VS 开发 C++ 时,您会遇到数据断点这一令人惊奇的功能,当内存中某个地址的数据发生变化时,就会触发断点。
在eclipse中开发java有类似的功能吗?
谢谢!
编辑:关于“值更改时暂停”功能:我的印象是执行仍然必须到达断点所在的行。问题是我希望它在值发生变化时立即在任何地方触发。
when developing C++ with VS you have this amazing feature of data breakpoints, which trigger when the data at a certain address in memory changes.
is there a similar feature when developing java in eclipse?
thanks!
edit: about the "suspend when value changes" feature: i have the impression that the execution must still reach the line where the breakpoint is. the thing is i want it to trigger anywhere as soon as the value changes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以在字段上设置观察点:将光标放在声明字段的行上,然后选择菜单
Run ->切换观察点
或者只需双击该行的左边距即可设置断点。
添加观察点后,您可以更改观察点的属性,例如
在字段访问时暂停
或在字段修改时暂停
。只需右键单击左侧边距的观察点并选择Breakpoint Properties...
搜索观察点的帮助以获取更多信息:
You can set a watchpoint on a field: put the cursor at the line where the field is being declared and select the menu
Run -> Toggle Watchpoint
or just set a breakpoint by double-clicking at the left margin on that line.
You can change the properties of the watchpoint like
suspend on field access
orsuspend on field modification
after adding it. Just right-click on the watchpoint at the left margin and selectBreakpoint Properties...
Search the help for watchpoint to get more information:
使用变量视图:
请注意,性能可能不如内存硬件断点(例如在 VC++ 中)。
Using the Variable view:
Note that the performance is probably not as good as with a memory hardware breakpoint (like in VC++ for example).
在断点属性下,您可以选择将其设置为有条件并选中单选按钮“值更改时暂停”。
Under breakpoint properties, you have the option of making it conditional and checking the radio button "Suspend when value changes".
右键单击断点并选择
断点属性
。在打开的屏幕中,选择:
Conditional ->当值改变时暂停
Right click on the Breakpoint and select
Breakpoint properties
.In the opening screen, choose:
Conditional -> Suspend when value changes
最接近的是编辑断点属性。您可以添加条件来检查不同的值。另一种方法是向 setter 方法添加断点。
您可以通过右键单击断点视图中已设置的断点来设置断点属性。
The closest thing would be editing the breakpoint properties. You could add conditions to check for distinct values. Another way could be adding a breakpoint to the setter method.
You can set the breakpoint properties by right-clicking on an already set breakpoint in the breakpoint view.
据我所知,Eclipse 中没有这样的通用功能。但是,您可以为现有断点指定一些条件:
在代码中的某处添加断点。然后,在“断点”视图中右键单击它,然后选择“断点属性”。在面板中,您可以添加必须验证的条件,以使应用程序在此断点处停止(例如
if (foo > 0)
)。这并不完全是你想要的,但我不认为 Eclipse 提供这样的功能。
As far as I know, there is no such generic feature in Eclipse. However, you can give some conditions to an existing breakpoint:
Add a breakpoint somewhere in your code. Then, in the "Breakpoint" view, right click on it, then choose "Breakpoint properties". In the panel, you can add a condition that must be verified to make the application stops on this breakpoint (for example
if (foo > 0)
).This is not exactly what you want, but I do not think Eclipse provides such feature.