Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse conditional debug

Tags:

java

eclipse

I'm wondering if there is a way to add a conditional break point in eclipse while debuging. Sample: if city=="New York" then break.

like image 839
Zemzela Avatar asked Aug 09 '11 10:08

Zemzela


People also ask

How do I create a conditional breakpoint in Eclipse?

How to create a conditional breakpoint To create a conditional breakpoint, first set a breakpoint on a line (Ctrl+Shift+B), right-click on the breakpoint and select Breakpoint Properties. Then configure a condition that returns a boolean. Eclipse only stops if the conditions returns true.

What is debugging in Eclipse IDE?

Debugging the Eclipse IDE for Java Developers. Debugging is the routine process of locating and removing bugs, errors or abnormalities from programs.

How to debug a Java application running outside eclipse?

Finally, if the application is running outside Eclipse, we can still use all the above functionalities, provided that the remote application allows debugging. From Eclipse, we would select Debug as Remote Java Application.

What's new in Eclipse CDT debug?

Whether using gdb or a different backend debugger, CDT Debug provides a consistent visual interface and has several powerful views that provide different insights into your code. This article highlights some of the newest and most useful features in Eclipse CDT 9.2 edition that helps save precious time while debugging your code.


2 Answers

Yes. Right-click on the breakpoint, select "Breakpoint properties", enable "Conditional" and then enter the condition. Note that city == "New York" wouldn't be a good condition due to the way equality works in Java, but "New York".equals(city) would be fine. Note that Eclipse allows simple Boolean conditions like this, and also "suspend when value changes".

like image 187
Jon Skeet Avatar answered Sep 29 '22 19:09

Jon Skeet


Here is the detailed tutorials. http://wiki.eclipse.org/FAQ_How_do_I_set_a_conditional_breakpoint%3F

like image 45
Sathwick Avatar answered Sep 29 '22 21:09

Sathwick