java/eclipse中的数据断点

发布于 2024-09-30 02:28:26 字数 178 浏览 0 评论 0原文

当使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

诗化ㄋ丶相逢 2024-10-07 02:28:26

您可以在字段上设置观察点:将光标放在声明字段的行上,然后选择菜单 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 or suspend on field modification after adding it. Just right-click on the watchpoint at the left margin and select Breakpoint Properties...

Search the help for watchpoint to get more information:

A watchpoint is a special breakpoint that stops the execution of an application whenever the value of a given expression changes, without specifying where it might occur. ...

花伊自在美 2024-10-07 02:28:26

使用变量视图:

  • 右键单击该字段并选择“切换观察点”,然后
  • 再次右键单击同一实例并选择“实例断点...”,这允许您将特定断点限制到给定实例。

请注意,性能可能不如内存硬件断点(例如在 VC++ 中)。

Using the Variable view:

  • right click the field and select "Toggle Watchpoint", and then
  • right click the same instance again and select "Instance breakpoints..." which allows you to restrict a specific breakpoint to a given instance.

Note that the performance is probably not as good as with a memory hardware breakpoint (like in VC++ for example).

玩套路吗 2024-10-07 02:28:26

在断点属性下,您可以选择将其设置为有条件并选中单选按钮“值更改时暂停”。

Under breakpoint properties, you have the option of making it conditional and checking the radio button "Suspend when value changes".

英雄似剑 2024-10-07 02:28:26

右键单击断点并选择断点属性

在打开的屏幕中,选择:Conditional ->当值改变时暂停

Right click on the Breakpoint and select Breakpoint properties.

In the opening screen, choose: Conditional -> Suspend when value changes

撑一把青伞 2024-10-07 02:28:26

最接近的是编辑断点属性。您可以添加条件来检查不同的值。另一种方法是向 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.

素衣风尘叹 2024-10-07 02:28:26

据我所知,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文