Eclipse 监视表达式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5486479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:04:39  来源:igfitidea点击:

Eclipse Watch Expression

eclipsedebugging

提问by Vincent

I would love a feature to put a breakpoint and stop there when a certain expression is true. Can this be accomplished with Expressions in Eclipse? Can someone give me an example (preferrable java)?

我希望有一个功能可以放置断点并在某个表达式为真时停止。这可以通过 Eclipse 中的表达式来完成吗?有人可以给我一个例子(最好是java)吗?

回答by Bozho

  1. Add a breakpoint
  2. right-click the breakpoint and choose "Breakpoint properties"
  3. Check "Enable condition"
  1. 添加断点
  2. 右键单击断点并选择“断点属性”
  3. 勾选“启用条件”

回答by CloudyMarble

回答by roberttdev

Yes, by clicking to the left of a line # in the code, you can set a breakpoint that the debugger will then stop at when you run the debugger in the Debug perspective. You can then look at the "Breakpoints" tab in that perspective and right click your breakpoint and choose "Properties", and there you can set a condition for the breakpoint to fire.

是的,通过单击代码中 # 行的左侧,您可以设置一个断点,当您在 Debug 透视图中运行调试器时,调试器将在该断点处停止。然后,您可以在该透视图中查看“断点”选项卡并右键单击您的断点并选择“属性”,然后您就可以设置触发断点的条件。