Yes they are called breakpoints. In your code in the loop that is infinite select one of the lines with the mouse and press F9 (default). Alternatively go to the grey margin on the left in the editor and click. In either case you'll see the red stop sign indicating a breakpoint is set. Now run your code. Every time the debugger hits that line it'll pause the program and throw you into the code.
Now you can step through your code using F10/F11 to verify each line is executing the way you want. Refer to this article on how to use breakpoints and step through code.
As for your actual problem you need to ensure that the loop variant (the thing that keeps the loop condition true) eventually becomes false in your code. If it doesn't and you have no break/return statements in your loop then it is infinite.