向 EclipseIDE 中类的所有方法添加方法断点

在 Eclipse 中,是否有一种方法可以在类的所有方法上设置方法断点,而无需转到单个方法?其背后的动机是,任何时候一个方法被命中,它都会在调试模式下转到该方法。

21738 次浏览

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.

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"

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.