Debugging and counting breakpoint hits

后端 未结 2 784
小蘑菇
小蘑菇 2020-12-17 09:05

Sometimes when I examine a code I didn’t write, I launch eclipse in debug mode and use figures to understand a program. For example, if they are n items retrieved from the D

相关标签:
2条回答
  • 2020-12-17 09:48

    You can add a condition into your breakpoint. The simplest one could look something like this:

    System.err.println("Passing checkpoint");
    return false;
    

    You can also extend it by calling your own static class:

    org.foo.StaticCounter.COUNTER++;
    System.err.println("Passing checkpoint " + org.foo.StaticCounter.COUNTER);
    return false;
    
    0 讨论(0)
  • 2020-12-17 10:09

    As an alternative to counting breakpoints, you could use a profiling tool, such as the one here.

    0 讨论(0)
提交回复
热议问题