Start debugging
You can start an application from an open project under the control of a debugger in the following ways:
- Select (Start Debugging of Startup Project).
- Press F5.
- Enter
dr
in the locator, and select the project to debug. - Go to Debug > Start Debugging > Start Debugging of Startup Project.
Qt Creator checks whether the compiled application is up-to-date, and rebuilds and deploys it if you set Build before deploying to build the whole project or the application to run and select Always deploy before running in Preferences > Build & Run > General. To debug the application without deploying it, go to Debug > Start Debugging > Start Debugging Without Deployment.
The debugger then takes over and starts the application with suitable parameters.
You can specify breakpoints before or after launching the debugger. For more information, see Setting Breakpoints.
Execute GDB or CDB commands
When using GDB or CDB as debug backend, you can specify additional commands to execute before and after the backend and debugged application are started or attached in Preferences > Debugger > GDB and CDB.
To let the debugger read the user's default .gdbinit file when it starts, select Load .gdbinit file on startup in GDB settings.
Note: Starting a C++ application under the control of the debugger can take a long time. Typically, in the range of several seconds to minutes if you use complex features.
Debug Python projects
For Python projects, start debugging the main.py
file. If you encounter problems, check the active build target in the kit selector.
Qt Creator does not support mixed-mode debugging, but you can attach GDB to the Python interpreter to debug the C++ implementation of the corresponding Python code. For more information, see Debugging PySide with Qt Creator (Linux).
Debug console applications
If you need a console window to operate your application, for example because it accepts console input from the user, go to Projects > Run Settings and select the Run in terminal check box.
If a console application does not start up properly in the configured console and the subsequent attach fails, you can diagnose the issue by using CDB's native console. Go to Preferences > Debugger > CDB > Use CDB console to override the console set in the Windows system environment variables. Note that the native console does not prompt on application exit.
See also How To: Debug, Debugging, Debuggers, and Debugger.
© 2024 The Qt Company Ltd. 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.