Does anyone know if there are any IDE's that can hit breakpoints on a condition?

For example, if I'm looking through a large list or iterating through a map or something, I may want to only suspend execution when an ID == "foo"

1.) Is this even possible to implement for IDE's
2.) Are there any plugins available for Eclipse to do this now?

  • I sure hope it's possible in a Java IDE seeing as that the C debugger I used back in 1989 on my PC/XT in DOS could do that. :-) Jul 6 '11 at 19:26

First, set a breakpoint at a given location. Then, use the context menu on the breakpoint in the left editor margin or in the Breakpoints view in the Debug perspective, and select the breakpoint’s properties. In the dialog box, check Enable Condition, and enter an arbitrary Java condition, such as list.size()==0. Now, each time the breakpoint is reached, the expression is evaluated in the context of the breakpoint execution, and the breakpoint is either ignored or honored, depending on the outcome of the expression.

Source: http://wiki.eclipse.org/FAQ_How_do_I_set_a_conditional_breakpoint%3F

Also, I believe you mean "ID == "foo"", because ID = "foo" will be an assignment and not a condition.

  • Excellent, didn't know about this.
    – Marcelo
    Jul 6 '11 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.