# 设置执行点

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/zh-cn/help/clion/llms.txt).

设置执行点   操作允许您在调试会话期间跳转到编辑器中的任意代码行，并在那里设置执行点，跳过中间的所有其他命令。

此操作适用于线性和非线性执行路径。 使用它可以中断并跳过循环，或在  `if-else`  子句表达式或  `switch -case`  语句中选择另一个分支。 例如，如果您想在不重新启动调试会话的情况下检查另一个分支，此操作会非常有用。

> **Note:**
> 您可以将执行指针向前或向后移动。 它同样适用于 [反汇编视图](disassembly-view.html)。

Procedure: 调用设置执行点

使用以下选项之一：

* 将边栏中的橙色箭头 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.debugger.nextStatement.svg) 拖动到所需的代码行。

![位于边栏的执行指针](https://resources.jetbrains.com/help/img/idea/2026.3/cl_set_execution_gutter.png)

* 将插入符号放置在所需的代码行，并从  `帮助 | 查找操作`  ( `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `⌘ ⇧ A` (Xcode), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Ctrl+Shift+A` (ReSharper), `⌘ ⇧ A` (ReSharper (macOS)), `Ctrl+Shift+A` (QtCreator), `⌘ ⇧ A` (QtCreator (macOS)), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS))) 调用   将执行点设置到光标处  。

![在操作查找中设置执行点](https://resources.jetbrains.com/help/img/idea/2026.3/cl_set_execution_findaction.png)

* 在  `设置 | 键位图`  中，为   将执行点设置到光标处   操作分配一个快捷键。

![为设置执行点分配快捷键](https://resources.jetbrains.com/help/img/idea/2026.3/cl_set_execution_shortcut.png)

保存设置，将插入符号放置在所需的代码行，并使用快捷键。

结果是，执行将从新位置恢复，跳过中间的命令。

![设置执行点](https://resources.jetbrains.com/help/img/idea/2026.3/cl_set_execution_linear.animated.gif)

使用   设置执行点   时，请务必考虑可能的负面后果：

* 如果您跳过了初始化变量的代码行，您将从堆栈/寄存器中获取该值。

* 如果可执行代码被编译器优化，您可能会得到不可预测的结果，或者根本无法移动执行点。

* 如果您跳转到当前控制流图中未调用的函数，CLion 将警告您执行可能会中断（目前 [不支持 GDB](https://youtrack.jetbrains.com/issue/CPP-21799)）。

* 此外，还有其他已知问题，例如 存在多个候选项 错误（ [CPP-21800](https://youtrack.jetbrains.com/issue/CPP-21800)）以及 `std::cin` 和 `std::cout` 的问题（ [CPP-22055](https://youtrack.jetbrains.com/issue/CPP-22055)）。

## See also

### 流程

[Stepping through](stepping-through-the-program.html) [断点](using-breakpoints.html)

### 外部链接

[Webinar Recording: CLion Ask Me Anything Session: Debugger](https://www.youtube.com/watch?v=Kz5NQiji9YU5&t=244s) [CLion Debugging Beyond the Basics - Part 2 - Dynamic](https://blog.jetbrains.com/clion/2021/03/clion-debugging-beyond-the-basics-part-2-dynamic) [Video playlist: CLion Debugger](https://www.youtube.com/playlist?list=PLQ176FUIyIUawCufBKmmWkRq2t5sl1xsM)

