常规
要设置所有调试器通用的常规首选项,请转至首选项>Debugger >General 。
您可以自定义调试视图的外观和行为,设置断点,以及将源路径映射到目标路径。
你可以在调试器日志视图中查看调试输出。不过,在某些 Linux 发行版(如 Arch Linux)中,调试输出会发送到系统日志。要覆盖这一行为,请选择Force logging to console 。这将在调试程序的环境中设置QT_LOGGING_TO_CONSOLE=1
,从而有效防止在系统日志中存储调试输出。
断点
要在断点中使用完整的绝对路径,请选择Set breakpoints using a full absolute path 。
GDB 和 CDB 允许在未生成代码的源代码行上设置断点。在这种情况下,断点会转移到实际生成代码的下一行源代码上。要通过移动源代码编辑器中的断点标记来反映这种临时变化,请选择GDB >Adjust breakpoint locations 或CDB >Correct breakpoint location 。
使用 GDB 作为后台时,可以使用 Python 扩展普通的 GDB 断点类。选择GDB >Use pseudo message tracepoints 。
使用 CDB 作为后端时,可以通过在CDB >Break on 中选择首选项,指定调试器应在特定事件(如 C++ 异常、线程创建或退出、加载或卸载应用程序模块或特定输出)时断开。要禁用访问违规异常的首次中断,请选择Ignore first chance access violations 。再次发生访问违规时将进入调试器。
您可以在某些函数上自动添加断点,以捕捉错误和警告信息。更多信息,请参阅CDB和GDB。
有关断点的更多信息,请参阅 GDB 文档中的断点、观察点和捕捉点。
源路径映射
为了使调试器能够进入代码并显示源代码,可以将源路径映射到目标路径。
要将源代码路径自动映射到未打补丁的 Qt 版本,请选择Add Qt Sources 并浏览到 Qt 源文件的位置。
要手动将源路径映射到目标路径:
- 在Source Paths Mapping 中,选择Add ,在路径列表中添加一个条目。
- 在Source path 中,指定调试器报告的可执行文件调试信息中的源路径。
- 在Target path 中,指定本机上源代码树的实际位置。
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.