Conditional breakpoint by caller in Java eclipse

試著忘記壹切 提交于 2019-12-03 12:59:45

It's pretty disgusting and probably slow, but you can use

Thread.currentThread().getStackTrace()[2].getClassName().contains("A")

as your breakpoint condition.

Based on this bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=72961 I don't think Eclipse will support it directly

Sentry

Eclipse can do that. Create a breakpoint, then go into the Debug perspective and into the "Breakpoints" view. Select the breakpoint and

There you can say enable "Conditional" and select "Suspend when value changes"

You then have to enter your value in the field below, in your case probably "minimum".

Edit:

I just tried that and it didn't work as expected, but I've found another solution that might work:

data breakpoints in java/eclipse

In summary: Create a breakpoint in the line where your field is defined, it will become a watchpoint. In the "Breakpoint Properties" you can specify it to only suspend on change (the symbol on the margin will be a pen), not on access (symbol will be a pair of glasses).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!