Debugging

A debugger lets you see what happens inside an application while it runs or when it crashes. A debugger can do the following to help you find errors in the application:

  • Start the application with parameters that specify its behavior.
  • Stop the application when conditions are met.
  • Examine what happens when the application stops.
  • Make changes in the application when you fix an error and continue to find the next one.

The Qt Creator debugger plugin acts as an interface between the Qt Creator core and external native debuggers that you can use to:

  • Debug executable binary files - GNU Symbolic Debugger (GDB), the Microsoft Console Debugger (CDB), and the debugger of the low level virtual machine (LLVM) project, LLDB.
  • Debug QML and Java code and Qt Quick applications - QML/JavaScript debugger.
  • Debug Python source code - PDB.

The following sections describe how to set up, launch, and interact with the debugger:

  • Setting Up Debugger

    The debugger plugin automatically selects a suitable native debugger for each kit from the ones found on your system. You can edit the kits to override this choice.

  • Launching the Debugger

    To start an application from an open project under the control of a debugger, select the (Start Debugging of Startup Project) button or press F5. Other, less common start options are available in the Debug > Start Debugging menu.

  • Debug Mode Views

    Use the views in the Debug mode to inspect the state of your application while debugging.

  • Stopping Applications

    You can interrupt a running application before it terminates or to find out why the application does not work correctly. Set breakpoints to stop the application for examining and changing variables, setting new breakpoints or removing old ones, and then continue running the application.

  • Examining Data

    You can examine variable values and data structures in detail.

  • Remote Debugging

    You can debug an application that runs on a remote target with the necessary helper processes also running.

  • Debugger Preferences

    Specify preferences for managing debugger processes. You can specify preferences that are common to all debuggers, or the native debugger that you use, GDB or CDB.

  • Using Debugging Helpers

    Qt Creator is able to show complex data types in a customized, user-extensible manner. For this purpose, it takes advantage of two technologies, collectively referred to as debugging helpers.

  • Debugging Qt Quick Projects

    When debugging a Qt Quick application, you can inspect the state of the application while debugging JavaScript functions. You can set breakpoints, view call stack trace, and examine locals and expressions. While the application is running, you can inspect QML objects and user interfaces, as well as execute JavaScript expressions.

  • Debugging a C++ Example Application

    Illustrates how to debug C++ applications in Qt Creator.

  • Debugging a Qt Quick Example Application

    Illustrates how to debug Qt Quick applications in Qt Creator.

  • Troubleshooting Debugger

    If you encounter problems while debugging, check for possible solutions to them.

© 2023 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.