Last semester I had some classes with students during which they had to prepare some easy projects. One of my requirements was that the project had to be implemented in Java, hence every team used Eclipse as an IDE. In my discussion with students it came out that a lot of them prefer debugger from Visual Studio over debugger from Eclipse. I was pretty surprised as I had a chance to use the VS debugger a lot in one of my projects and it didn't make good impression. When I got into details during the discussions it looked like the students had no idea about many features of Eclipse debugger and after some time some of them agreed that it is better then VS debugger.
This situation made me think that there is a need for some kind of tour through Eclipse debugger's features to share our knowledge about this great tool. Every week I will try to write a little bit about one of the debuger's aspect. If you have any hints or hacks for the debugger let me know - we can learn from each other!
Types of breakpoints
I would like to start with different kinds of breakpoints that are available in the debugger. We can use:
- line breakpoint
- method breakpoint
- field breakpoint
- class breakpoint
- java exception breakpoint
I guess that most of us use usually the first type and we tend to forget about others, however, that often can come very handy.
Line breakpoints
The post popular ones, so I won't get into the details. They make the execution pause whenever the given (marked as breakpoint) line is hit. Breakpoints like this can be created by clicking the ruler on the line we want to put the breakpoint on.
Method breakpoints
This kind of breakpoints pauses the execution whenever the processing enters or/and exists the given method. Breakpoints like this can be created by clicking the ruler on the line where the name of the method in the declaration of the method is written.
When we look to the breakpoint properties (right click on the breakpoint and choose Breakpoint Properties...) we will find the option to activate the breakpoint on method entry or/and exit:
Field breakpoints
Field breakpoints pause the execution whenever the given field is read or/and modified.
In the breakpoint properties we can set when the breakpoint is active:
Class breakpoints
These breakpoints pause the processing when the given class (or interface) is loaded by the JVm for the first time.
Java exception breakpoints
Allow to pause the execution of the application when particular exception is thrown. They can be set in the Breakpoints view. Choose Add Java Exception Breakpoint option:
and give the name of the exception you want to monitor:
In the end in the breakpoint properties you can set if you want this breakpoint to be active on caught or/end uncaught exceptions or maybe on subclasses of the given exception:
Did I miss any kind of breakpoints?
Next time I will try to write about the Hit count option and the breakpoints' conditions.
Thursday, December 11, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
One point: they are Java Exception Breakpoints...not Java Execution and the toolbar action is "Add Java Exception Breakpoint".
Yes, you are right. I mus have had some problems with my eyes yesterday ;) Thanks!
Post a Comment