在调试视图中检查复杂值
Qt Creator 调试器视图以简洁明了的方式显示来自调试器的原始信息,从而简化了调试过程,同时又不失调试器的强大功能。
Locals和Expressions视图以树形显示结构化数据,如class
、struct
或union
类型的对象。要访问对象的子结构,可展开树节点。树形视图按内存顺序显示子结构。要按字母顺序显示,请在上下文菜单中选择Sort Members of Classes and Structs Alphabetically 。
同样,指针也显示为一个树状项,其单个子项代表指针的目标。在上下文菜单中选择Dereference Pointers Automatically ,可将指针和目标合并为一个条目,显示指针的名称、类型和目标值。
标准表示法足以检查简单结构,但通常无法深入了解更复杂的结构,如QObjects
或关联容器。这些项目的内部结构由指针的复杂排列表示,通常经过高度优化,部分数据既不能通过子结构也不能通过指针直接访问。
为了简洁明了地显示QObjects
或关联容器等复杂结构,Qt Creator 使用了被称为调试帮助程序的 Python 脚本。
除了堆栈(Stack)、Locals 、Expressions 、寄存器(Registers)和其他视图的通用集成开发环境功能外,Qt Creator 还能轻松调试基于 Qt XML 的应用程序。调试器插件能理解多个 Qt 类的内部布局,例如QString 、Qt 容器,以及最重要的QObject (和从它派生出来的类),以及 C++ 标准库的大多数容器和一些 GCC 扩展。它利用这种更深入的理解,以有用的方式展示这些类的对象。
要更改扩展条目时请求的数组元素数量,请访问首选项>Debugging >Locals & Expressions >Default array size 。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.