Brazilian, developer by profession, gamer for fun, amateour athletic and cyclist promising. Passionate for technology and inovation, Agile methodologies evangelist as SCRUM and Kanban, make continuous process improvements and sharing the knowledge. Especialist in Enterprise Java, web application and Open Source techonologies since 2007. Valdemar has posted 6 posts at DZone. View Full User Profile

Breakpoint Properties in Eclipse

03.12.2011
| 9113 views |
  • submit to reddit
The Eclipse IDE has the ability to run the code interactively, executing an application line by line in debug mode where you can define a specify point in the code to stop, called a breakpoint. As you can see in Eclipse documentation:

"A breakpoint suspends the execution of a program at the location where the breakpoint is set".

But when you are debugging an application, sometimes, you don't want the application to stop everytime in the breakpoint. For example, in a loop where the code iterates through a lot of object.

The solution for these situations is conditional breakpoint. To set a conditional breakpoint, right-click on breakpoint in the left hand side and click "breakpoint properties.." in Eclipse.



After that you'll see the following screen:

screen_BP_eclipse

You set a condition in a breakpoint so that it will stop at this point when the condition is true. In this example, the application will be suspend when the request's method is "POST".
There are others options to set a condition in the breakpoint, for example, the count of hit the application.

So, that's it. Did you know about this tip or any other interesting features in Eclipse?
4
Your rating: None Average: 4 (3 votes)
Published at DZone with permission of its author, Valdemar Júnior.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Nirav Purohit replied on Mon, 2011/03/14 - 12:31pm

Nice tip. Never explored that.

Valdemar Júnior replied on Sun, 2011/03/20 - 12:52pm in response to: Nirav Purohit

Thanks Nirav.

Javin Paul replied on Fri, 2011/04/08 - 10:01am

 

Conditional breakpoint is really powerful feature eclipse offered and i have used it a lot during my project particularly useful if you want to stop execution only for a particluar thread or a particular condition. See my blog post Java and eclipse remote deubgging for more debugging tips.

Avi Bhardwaj replied on Fri, 2012/11/02 - 1:50am

 Hello,

I want to check value of an object in debug, with the help of Line Breakpoint in eclipse by enabling condition in Breakpoint Properties.

But not able to use conditional operators like || or && to club 2-3 conditions.

Kindly suggest, if it is possible in eclipse.

Cheers,

Avi

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.