# 监视点

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

监视点（有时称为  数据断点 ）在您需要关注特定变量及其在程序执行过程中的行为时非常有用。 每当您的程序访问正在监视的断点时，CLion 将暂停执行或记录到控制台。

Procedure: 设置监视点

1. 选择一个变量或表达式，右键点击并选择   添加监视点  ：

![添加监视点](https://resources.jetbrains.com/help/img/idea/2026.3/cl_addwatchpoint.png)

2. 在弹出窗口中配置监视点：

![配置监视点](https://resources.jetbrains.com/help/img/idea/2026.3/cl_watchpointparams.png)

要访问其他属性，请点击   更多   `Ctrl+Shift+F8` (Windows), `⌘ ⇧ F8` (macOS), `⌘ ⇧ F8` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F8` (macOS System Shortcuts), `Ctrl+Shift+F8` (XWin), `Ctrl+Shift+F8` (GNOME), `Ctrl+Shift+8` (KDE), `Ctrl+Shift+F8` (Emacs), `Ctrl+Shift+F8` (Sublime Text), `⌘ ⇧ F8` (Sublime Text (macOS)), `⌘ 8` (Xcode), `Ctrl+Alt+B` (Visual Studio), `⌘ ⌥ B` (Visual Studio (macOS)), `Ctrl+Shift+F8` (ReSharper), `⌘ ⇧ F8` (ReSharper (macOS)), `Ctrl+Shift+F8` (QtCreator), `⌘ ⇧ F8` (QtCreator (macOS)), `Ctrl+Shift+F8` (NetBeans), `Ctrl+Shift+F8` (Eclipse), `⌘ ⇧ F8` (Eclipse (macOS))或从主菜单中选择  `运行 | 查看断点` ：

![监视点设置](https://resources.jetbrains.com/help/img/idea/2026.3/cl_watchpointsettings.png)

|  选项  |  描述  |
| --- | --- |
|    已启用    |  选中或清除此复选框以启用或禁用监视点。  |
|    暂停执行    |  如果选择此选项，程序的执行将在   访问类型  字段中指定的事件处停止。 如果清除此复选框，程序不会在监视点命中时停止，但任何相关的操作（例如日志记录）仍会执行。  |
|    日志    |  选中这些复选框以将  断点命中 消息或监视点的  堆栈跟踪 记录到控制台。 如果您希望在不停止程序执行的情况下分析变量的变化，这将非常有用。  |
|    禁用直到命中以下断点    |  此选项会禁用当前监视点，直到遇到其他断点。  |
|    访问类型    |  选择将触发监视点的访问类型：读取、写入或任意。  |

## 在调试中使用监视点

设置并配置监视点后，您可以继续调试以监控对所选变量的访问。 如果启用了暂停功能，程序将在监视点命中时停止，CLion 会突出显示相应的代码行。 如果还启用了记录到控制台功能，输出将显示在   控制台  选项卡中：

![监视点命中](https://resources.jetbrains.com/help/img/idea/2026.3/cl_watchpointhit.png)

监视点的图标与常规断点的图标不同（上面有一个“眼睛”）。 将鼠标悬停在其上以查看包含当前监视点命中详细信息的弹出消息：

![监视点工具提示](https://resources.jetbrains.com/help/img/idea/2026.3/cl_watchpointhit_eyemessage.png)

现在，您已将变量行为与程序流程的其余部分隔离开来。 您可以移除监视点并使用 [单步执行](stepping-through-the-program.html)技术，或创建更多断点以分析问题的实际原因。

## See also

### 概念

[Run/Debug Configurations](run-debug-configuration.html) [断点](using-breakpoints.html)

### 参考

[Debug Tool Window](debug-tool-window.html)

### 流程

[调试](debugging-code.html) [检查挂起的程序](examining-suspended-program.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)

