JetBrains Rider 2017.2 Help

Stepping through Code

While examining a suspended program, you get control over the program execution — by manually stepping through the program, you can advance the execution point to the code you are interested in. There are multiple ways of how you can do this described in this section.

The current execution point is the next line to be executed. This line is always highlighted with yellow in the editor during debugging. To quickly find the current execution point, press Alt+NumPad * or click Show Execution Point frames show execution point in the Debug window.

Stepping into code

Sometimes, you may need to debug code line by line, stepping into all nested function calls.

Actually, the debugger works not with lines of code but with statements. For example, the single line if (x > 0) return true; consists of two statements. There will be two separate debugger steps: one for if (x > 0) and another for return true.

To step on each line of code

  • After a breakpoint is reached, do one of the following:
    • Press F11.
    • In the main menu, select Run | Step Into.
    • In the Debug window, click Step Into frames step into.

If you no longer want to debug a function (e.g., the one you've just stepped into), you can tell the debugger to step out of it. In this case, the debugger will execute the remaining lines of the function by itself. The next statement will be the one following the function call.

To step out of a function

  • Do one of the following:
    • Press Shift+F11.
    • In the main menu, select Run | Step Out.
    • In the Debug window, click Step Out. frames step out

Stepping through code

If you are not interested in how a particular function works, you can skip it over (the function will still be executed).

To step over a line of code

  • After a breakpoint is reached, do one of the following:
    • Press F10.
    • In the main menu, select Run | Step over.
    • In the Debug window, click Step over. frames step over

If a function you want to skip over contains breakpoints, you can force the debugger to skip it.

To step over a function ignoring the breakpoints inside it

  • After a breakpoint is reached, do one of the following:
    • Press Shift+Alt+F8.
    • In the main menu, select Run | Force Step over.
    • In the Debug window, click Force step over force step over.

Running to a specific location

If you know exactly what code you want to inspect, you can tell the debugger to run to a specific statement. The easiest way to do so is to run the program to the current cursor location.

To run to the cursor location

  1. Set the cursor at the statement where you want to suspend execution.
  2. Do one of the following:
    • Press Ctrl+F10.
    • In the main menu, select Run | Run to Cursor.
    • In the Debug window, click Run to Cursor frames run to cursor.

If there are breakpoints between the current execution point and the cursor location, you can force the debugger to skip these breakpoints.

To run to the cursor location skipping breakpoints

  1. Set the cursor at the statement where you want to suspend execution.
  2. Do one of the following:
    • Press Ctrl+Alt+F9.
    • In the main menu, select Run | Force Run to Cursor.

Breaking into code

While the program runs, you can break its execution at any time. The debugger will stop at the next available line of code.

To break into code

  • Do one of the following:
    • PressCtrl+Pause.
    • In the main menu, select Run | Pause Program.

Changing the execution flow

Sometimes, you may want to skip a part of code without actually executing it (e.g., to avoid a known bug) or to return to a statement that has been already executed. This can be done by forcibly setting the next statement.

To set the next statement

  1. Set the cursor at the statement you want to be next.
  2. Do one of the following:
    • PressCtrl+Shift+F10.
    • In the main menu, select Run | Set Next Statement.

Important notes:

  • Statements between the old and the new execution points are not executed.
  • It is impossible to set the next statement in another function.
  • When moving backwards, the already executed statements are not undone.
Last modified: 27 December 2017