CLion 2021.1 Help

Step through

CLion provides a set of stepping actions for various debugging strategies (for example, whether you need to go directly to the next line or enter the functions called on your way there).

The stepping buttons are located on the Debug window toolbar.

Stepping buttons

Step over

Steps over the current line and takes you to the next line even if the current line includes function calls. The calls are skipped, and you move straight to the next line of the caller.

  • Click the Step over button Step Over button or press F8.

If there are breakpoints inside the skipped methods, the debugger will stop at them. To skip any breakpoints on the way, use Force step over.

Step into

Steps inside the code of a called function.

  • Click the Step into button Step Into button or press F7.

Some methods are skipped by Step into as you normally might not need to debug them. This list can be fine-tuned on the Build, Execution, Deployment | Debugger | Stepping page of the Settings/Preferences dialog Ctrl+Alt+S.

Smart step into

Smart step into is helpful when there are several method calls on a line, and you want to be specific about which method to enter. This feature allows you to select the method call you are interested in.

  1. From the main menu, select Run | Debugging Actions | Smart Step Into or press Shift+F7.

  2. Click the method. You can also select it using the arrow keys or tabs and press Enter/ F7.

You can configure Smart step into to be used instead of the regular Step into every time there are multiple method calls on the line. This is done in Settings/Preferences | Build, Execution, Deployment | Debugger | Stepping.

Step out

Steps out of the current function and takes you to the code the caller.

  • Click the Step out button Step Out button or press Shift+F8.

Run to cursor

Continues the execution until the position of the caret is reached.

  1. Place the caret at the line where you want the program to pause.

  2. Click the Run to cursor button Run to Cursor button or press Alt+F9.

Also, you can Run to Cursor by clicking the line number in the gutter.

You can configure whether you want Run to Cursor to work on clicking a line number in Settings/Preferences | Build, Execution, Deployment | Debugger.

To skip any breakpoints on the way, use Force run to cursor.

Force step into

Steps into the function even if it is skipped by the regular Step Into by default.

  • Click the Force step into button Force Step Into icon or press Alt+Shift+F7.

In case the source code of the function that you want to step into is unavailable, you can debug disassembled code in a dedicated view.

Force run to cursor

Continues the execution until the position of the caret is reached. All breakpoints on the way are ignored.

  1. Place the caret at the line where you want the program to pause.

  2. From the main menu, select Run | Debugging Actions | Force Run to Cursor or press Ctrl+Alt+F9.

Force step over

Steps over the current line of code and takes you to the next line even if the highlighted line has method calls in it. If there are breakpoints in the called methods, they are ignored.

  • From the main menu, select Run | Force Step Over or press Alt+Shift+F8.

Reversible debugging

Although reversible debugging is not supported in CLion out-of-the-box, you can set it up on Linux using the Undo plugin.

The plugin integrates the Undo ’s record, rewind and replay technology in CLion. With Undo, you can record the program’s execution down to single instruction for further replay and analysis. This way, the debugger gets reversible: you can step forwards and backwards in your code and see exactly what is happening.

Read this blog post and watch this webinar recording for more information.

Last modified: 08 June 2021