eclipse 在EclipseIDE中给一个类的所有方法添加方法断点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2685445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:38:42  来源:igfitidea点击:

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

eclipse

提问by Luke

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 中,有没有一种方法可以在类的所有方法上设置方法断点,而无需转到单个方法?背后的动机是,任何时候一个方法被命中,它都会在调试模式下转到那个方法。

回答by sanderty

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"

最快的方法是转到“大纲”视图并选择您想要的所有方法,右键单击并单击“切换方法断点”

回答by VonC

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.

我所知道的没有直接的方法。
但是,如果您添加AspectJ(即面向方面的扩展),您可以编写一个“建议”,您将在运行时输入类的每个方法时为其设置。

alt text

替代文字

You could then set a breakpoint in that advice code.

然后,您可以在该建议代码中设置断点。