启动和调试外部应用程序

要调试本地或远程机器上的任何可执行文件而无需使用项目,可指定一个构建和运行工具包,该工具包可识别要调试应用程序的设备。

虽然启动外部调试器模式并不严格要求在Qt Creator 中打开项目,但打开项目可以更方便地设置断点和步进代码。

要启动和调试外部应用程序,请

  1. 访问Debug >Start Debugging >Start and Debug External Application

    启动和调试外部应用程序对话框

  2. Kit 中,选择用于构建项目的构建和运行工具包。
  3. Local executable 中,指定本地计算机上应用程序可执行文件的路径。
  4. Command line arguments 中,指定要传递给可执行文件的命令行参数。
  5. Working directory 中,指定工作目录。默认为构建结果的目录。
  6. 为控制台应用程序选择Run in terminal
  7. 选择Break at "main" 可在主函数处停止调试器。
  8. 选择Use target extended-remote to connect ,在target extended-remote mode 中创建连接。在此模式下,当调试程序退出或您从程序中脱离时,调试器仍与目标相连。您可以重新运行应用程序,附加到正在运行的应用程序,或使用目标机专用的监控命令。例如,除非使用--once 选项调用,否则 GDB 不会退出,但可以使用monitor exit 命令使其退出。
  9. Override SysRoot 中,指定要使用的sysroot 的路径,而不是默认的sysroot
  10. Debug information 中,指定调试信息的存储位置。不能使用空路径。
  11. Recent 中,可以选择要使用的最新配置。

另请参阅 "为项目激活工具包"、" 如何:调试"、"调试"、"调试器"和 "调试器"。

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.