Zemzela
Zemzela

Reputation: 3080

Eclipse conditional debug

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.

Upvotes: 5

Views: 1535

Answers (3)

uı6ʎɹnɯ ꞁəıuɐp
uı6ʎɹnɯ ꞁəıuɐp

Reputation: 3481

Open the context menu over a break point on the left bar of the code editor, select "Breakppoint properties..." and "Enable condition"

Upvotes: 2

Sathwick
Sathwick

Reputation: 1331

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

Upvotes: 4

Jon Skeet
Jon Skeet

Reputation: 1502166

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".

Upvotes: 8

Related Questions