CLion
 
Get CLion
Join the CLion 2025.1 Early Access Program and try out new features before they are released! Find out more

Set execution point

Last modified: 08 October 2024

The Set Execution Point action allows you to jump to an arbitrary line of code in the editor during a debug session and set the execution point there, skipping all the other commands in between.

This action works for both linear and non-linear execution paths. Use it to break and skip loops, or select another branch in an if-else clause expression or switch -case statement. For example, this action can be useful if you want to check another branch without restarting the debug session.

As a result, execution will be resumed from the new location, skipping the commands in between.

https://resources.jetbrains.com/help/img/idea/2024.3/cl_set_execution_linear.png
Gif

When using Set Execution Point, make sure to take the possible negative consequences into account:

  • If you jump over the line at which a variable is initialized, you will get the value from the stack/register.

  • In case the executable code was optimized by the compiler, you might get an unpredictable result or be unable to move the execution point at all.

  • If you jump to a function that is not called in the current control flow graph, CLion will warn you that the execution might be broken (not supported for GDB currently).

  • Also, there are other known issues like the multiple candidates exist error (CPP-21800) and problems with std::cin and std::cout (CPP-22055).