Add a method breakpoint to all methods of a class in EclipseIDE

Eclipse

Eclipse Problem Overview


In Eclipse, is there a way you can set Method Breakpoints on all the methods of the class without going to individual methods? The motivation behind is that, any time a method gets hit, it would go to that method in debug mode.

Eclipse Solutions


Solution 1 - Eclipse

The fastest way is to go to the "Outline" view and select all of the methods you want, right-click and click "Toggle Method Breakpoint"

Solution 2 - Eclipse

No direct way that I know of.
But if you add AspectJ (that is aspect-oriented extension), you could write an "advice" that you would set on each method of a Class when entering them on runtime.

alt text

You could then set a breakpoint in that advice code.

Solution 3 - Eclipse

In Eclipse, we can add breakpoint at every method of a class at once.

In your Project Explorer --> (go to the class) expand the class. It will give you a list of declaration and methods. There,

  1. Select all the methods using ctrl.
  2. Right click and select Toggle Method Breakpoint.

That's all. Which ever method you select, a breakpoint will be placed.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLukeView Question on Stackoverflow
Solution 1 - EclipsesandertyView Answer on Stackoverflow
Solution 2 - EclipseVonCView Answer on Stackoverflow
Solution 3 - EclipseCharan T SView Answer on Stackoverflow