Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Breakpoint in loop after large number of iterations in Eclipse

Suppose I have the following code. While debugging, I want Eclipse to stop when it has done 1 million iterations. How to do this? I cannot manually do 1 million times.

for(int i = 0; i < 10000000; i++) {
    //some code
}
like image 998
codepk Avatar asked Oct 07 '13 03:10

codepk


People also ask

Does a breakpoint stop all threads?

The thread-id specifier is one of the thread identifiers assigned by GDB, shown in the first column of the ' info threads ' display. If you do not specify ' thread thread-id ' when you set a breakpoint, the breakpoint applies to all threads of your program.

How do I set breakpoint conditions in eclipse?

First, set a breakpoint at a given location. Then, use the context menu on the breakpoint in the left editor margin or in the Breakpoints view in the Debug perspective, and select the breakpoint&#146;s properties. In the dialog box, check Enable Condition, and enter an arbitrary Java condition, such as list. size()==0.

Why breakpoints are not working in Eclipse?

Check that your project is in the Source tab in Debug Configurations. If it's not then the breakpoints are ignored.

How do I add a breakpoint to all methods in eclipse?

Select all the methods using ctrl . Right click and select Toggle Method Breakpoint .


1 Answers

You can put conditional break point in eclipse:

  1. Put a breakpoint
  2. Right-click->Properties
  3. Turn on "condition" check-box
  4. Put condition code

    i == 1000000

like image 142
Iuri Covalisin Avatar answered Nov 15 '22 16:11

Iuri Covalisin