Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable breakpoint after a number of hits

I want to debug a huge collection of 760000 records but in record 54000 it hangs and I want to debug the loop but don't want to continue 54000 times manually.

Is it possible to put a condition in IntelliJ to stop the thread after a number of iterations?

I Don't know the exact size of the collection as it is an Iterable and I don't know how to get the index.

Edit: I guess I could work around it and edit the code to insert the counter in the loop and create a condition on a breakpoint to stop on the iteration I suspect wrong.

for (Item item: iterable) {
counter++;
}

And then condition the breakpoint.

counter==54000

But unfortunately, I can't amend the code to add that counter.

*Using Community Edition of IntelliJ

like image 314
LazerBanana Avatar asked Oct 17 '22 14:10

LazerBanana


1 Answers

Right click on the breakpoint in question. It will open a small dialog box with a few options. Select More at the bottom. Now you will see a context menu where you can set "pass count".

You can enter it in that box, regardless of whether you want to set other special conditions on your breakpoint.

like image 66
Marc Avatar answered Oct 21 '22 09:10

Marc