当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Add breakpoint through code

问题描述:

If we add conditional breakpoints in java, the debugging becomes slow. is there a way we can add some statement which will cause the process of flow to stop there.

for eg.

 if(r>5 &&r<10)

{

stopExcecutionFlowAndStartDebugging();

}

网友答案:

Breakpoints are not Java. Breakpoints are IDE specific. Ergo, a Java method call isn't going to force the IDE to stop running normally and start debugging, because it isn't Java that initiates that in the first place.

But, and I'm sure you've already considered this, what's wrong with:

if(r > 5 && r < 10) {
    methodCall() // Add break point here.
}
网友答案:

You can have a conditional breakpoint, but the solution will depend on your IDE. For Eclipse: https://wiki.eclipse.org/FAQ_How_do_I_set_a_conditional_breakpoint%3F

But if you asking if you can switch between debugging and not debugging, then the answer is no. All you can do is control where you put the breakpoints and how you use them.

分享给朋友:
您可能感兴趣的文章:
随机阅读: