如何在Eclipse中使用条件断点?
我想知道如何在 Eclipse 中放置条件断点。我有这样的代码:
public static void doForAllTabs(String[] tablist){
for(int i = 0; i<tablist.length;i++){
--> doIt(tablist[i]);
}
}
现在我想在带有箭头的行上放置一个断点,但希望它仅在以下情况下触发:
tablist[i].equalsIgnoreCase("LEADDELEGATES");
I want to know how to place a conditional breakpoint in Eclipse. I have a code like:
public static void doForAllTabs(String[] tablist){
for(int i = 0; i<tablist.length;i++){
--> doIt(tablist[i]);
}
}
Now I want to put a breakpoint on the line with the arrow but want it to trigger only if:
tablist[i].equalsIgnoreCase("LEADDELEGATES");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
设置断点。
右键单击边缘的断点图像,然后选择断点属性:
配置您认为合适的条件:
Put your breakpoint.
Right-click the breakpoint image on the margin and choose Breakpoint Properties:
Configure condition as you see fit:
在
doIt(tablist[i]);
行上创建一个普通断点右键单击 ->;属性
检查“有条件”
输入
tablist[i].equalsIgnoreCase("LEADDELEGATES")
Make a normal breakpoint on the
doIt(tablist[i]);
lineRight-click -> Properties
Check 'Conditional'
Enter
tablist[i].equalsIgnoreCase("LEADDELEGATES")
1. 创建一个类
2. 右键单击左侧 System.out.println( tablist[i]); 在 Eclipse 中
--> 选择切换断点
3. 右键单击 切换点 < strong>--> 选择 断点属性
4. 检查 条件< /strong> 复选框 --> 写入 tablist[i].equalsIgnoreCase("amm") 在文本字段 --> 点击 确定
5. 右键单击课程 -- > 调试为 --> Java 应用程序
1. Create a class
2. Right click on left side of System.out.println(tablist[i]); in Eclipse
--> select Toggle Breakpoint
3. Right click on toggle point --> select Breakpoint properties
4. Check the Conditional Check Box --> write tablist[i].equalsIgnoreCase("amm") in text field --> Click on OK
5. Right click on class --> Debug As --> Java Application
来自 Eclipsepedia 关于如何设置条件断点:
From Eclipsepedia on how to set a conditional breakpoint:
您需要遵循一些简单的步骤来触发条件断点。
步骤 1 - 将断点放在断点条件为 True 时要运行的行上(现在问题是在哪里放置断点条件)
步骤 2 - 放置断点后,只需右键单击放置在的小断点图像上代码的左边距。
步骤3-点击后你会发现一些选项,点击断点属性。
步骤 4- 单击后,您将找到复选框,即“条件”,只需选中它
步骤 5- 将出现文本框“启用”,您需要在其中写入条件,只有当条件成立时,才会执行有断点的行
希望你发现我的答案有用
There are Simple step which you need to follow to trigger the conditional breakpoint.
Step 1- Put the breakpoint on that line which you want to be run when the breakpoint condition falls True (Now the question arises where to put the breakpoint condition)
Step 2- After putting the breakpoint simply right click on the small breakpoint image placed on the left margin of your code.
Step 3- After clicking you will find an some options click on the breakpoint properties.
Step 4- After clicking you will find checkbox i.e Conditions, simply check it
Step 5- There will be text box Enable in which you need to write the condition upon which the line which has breakpoint will have been executed only when the condition falls true
Hope you find my Answer usefull
一种可能更方便的方法是:在想要断点的地方编写一个 if 语句并在其内容中设置断点。
(断点由箭头表示)
这样,断点仅在条件为真时才会触发。如果没有那么多弹出窗口,这可能会更容易。
A way that might be more convenient: where you want a breakpoint, write a if statement and set a breakpoint in its contents.
(the breakpoint is represented by the arrow)
This way, the breakpoint only triggers if your condition is true. This could potentially be easier without that many pop-ups.