Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse beakpoint: stop before leaving a Java method

Is there a way to tell the debugger to stop just before returning, on whichever statement exits from the method, be it return, exception, or fall out the bottom? I am inspired by the fact that the Java editor shows me all the places that my method can exit - it highlights them when you click on the return type of the method declaration, (Mark Occurrences enabled).

[eclipse 3.4]

like image 610
Chris Noe Avatar asked Oct 13 '08 15:10

Chris Noe


2 Answers

Put a breakpoint on the line of the method signature. That is where you write

public void myMethod() {

Then right-click on the breakpoint and select "Breakpoint Properties". At the bottom of the pop-up there are two checkboxes: "Method Entry", "Method Exit". Check the latter.

like image 118
idrosid Avatar answered Oct 11 '22 14:10

idrosid


You can set a method breakpoint.

Double click in the margin next to the method declaration. A breakpoint with an arrow decoration appears. Right-clicking to examine the properties, you can set "Suspend on:" for "Method Entry" and/or "Method Exit".

You can read more about them in the Eclipse Cookbook.

like image 20
jamesh Avatar answered Oct 11 '22 13:10

jamesh