Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
    
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. :-) –  Brian Knoblauch Jul 6 '11 at 19:26

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
Excellent, didn't know about this. –  Marcelo Jul 6 '11 at 17:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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