Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Launching the Debugger

To start a program under the control of the debugger, select Debug > Start Debugging > Start Debugging, or press F5. Qt Creator checks whether the compiled program is up-to-date, and rebuilds it if necessary. The debugger then takes over and starts the program.

Note: Starting a program in the debugger can take a long time, typically in the range of several seconds to minutes if complex features (like QtWebKit) are used.

The debugger is launched in the appropriate operating mode (plain, terminal, or on-device), based on the build and run settings for the active project. Select Debug menu options to launch the debugger in other modes.

Note: Debugging QML and JavaScript is supported only in plain mode.

Launching the Debugger in Different Modes

The debugger plugin runs in different operating modes depending on where and how the process is started and run. Some of the modes are only available for a particular operating system or platform.

You can launch the debugger in the following modes:

  • Plain to debug locally started applications, such as a Qt based GUI application.
  • Terminal to debug locally started processes that need a console, typically without a GUI.
  • Attach to debug local processes started outside Qt Creator.
  • Remote to debug a process running on a different machine.
  • Core to debug crashed processes on Unix.
  • Post-mortem to debug crashed processes on Windows.
  • On-device to debug processes running on a mobile device.

Note: Debugging QML and JavaScript is supported only in plain mode.

Launching in Plain Mode

To launch the debugger in the plain mode, click the Start Debugging button for the active project, or choose Debug > Start Debugging > Start and Debug External Application... and specify an executable.

Launching in Terminal Mode

To launch the debugger in the terminal mode, select Projects > Run Settings and select the Run in terminal check box. Then click the Start Debugging button for the active project.

Launching in Attach Mode

To launch the debugger in the attach mode, select Debug > Start Debugging > Attach to Running External Application..., and then select a process by its name or process ID to attach to.

You can load the source project in advance and set breakpoints in it before attaching to an already running process. For more information, see Setting Breakpoints.

Launching in Remote Mode

The remote mode allows you to debug processes that run on remote machines.

Using GDB

In remote mode, the local GDB process talks to a GDB server process running on the remote machine that controls the process to be debugged.

The GDB server process is started on the remote machines by passing a port number and the executable:

 gdbserver :1234 <executable>

It then typically responds:

 Process bin/qtcreator created; pid = 5159
 Listening on port 1234

On the local machine that runs Qt Creator:

  1. Select Debug > Start Debugging > Start and Attach to Remote Application....
  2. In the Host and port field, enter the name of the remote machine and the port number to use.
  3. Select OK to start debugging.

Using CDB

In remote mode, the local CDB process talks to a CDB process that runs on the remote machine. The process is started with special command line options that switch it into server mode. The remote CDB process must load the Qt Creator CDB extension library that is shipped with Qt Creator:

  1. Install the Debugging Tools for Windows on the remote machine. The installation folder contains the CDB command line executable (cdb.exe).
  2. Copy the Qt Creator CDB extension library from the Qt installation directory to the a new folder on the remote machine (32 or 64 bit version depending on the version of the Debugging Tools for Windows used):
    • \lib\qtcreatorcdbext32\qtcreatorcdbext.dll (32 bit)
    • \lib\qtcreatorcdbext64\qtcreatorcdbext.dll (64 bit)
  3. Set the _NT_DEBUGGER_EXTENSION_PATH environment variable to point to that folder.
  4. To use TCP/IP as communication protocol, launch remote CDB as follows:
             cdb.exe -server tcp:port=1234 <executable>
  5. On the local machine running Qt Creator, select Debug > Start Debugging > Attach to Remote CDB Session...
  6. In the Connection field enter the connection parameters. For example, for TCP/IP:
             Server:Port

    If you chose some other protocol, specify one of the alternative formats:

             tcp:server=Server,port=Port[,password=Password][,ipversion=6]
             tcp:clicon=Server,port=Port[,password=Password][,ipversion=6]
             npipe:server=Server,pipe=PipeName[,password=Password]
             com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]
             spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]
             ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]
             ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]
  7. Click OK to start debugging.

Launching in Core Mode

The core mode it used to debug core files (crash dumps) that are generated from crashed processes if the system is set up to allow this.

To enable the dumping of core files on a Unix system enter the following command in the shell from which the application will be launched:

 ulimit -c unlimited

To launch the debugger in the core mode, select Debug > Start Debugging > Attach to Core....

Launching in Post-Mortem Mode

The post-mortem mode is available only on Windows, if you have installed the debugging tools for Windows.

The Qt Creator installation program asks you whether you want to register Qt Creator as a post-mortem debugger. To change the setting, select Tools > Options... > Debugger > Common > Use Creator for post-mortem debugging.

You can launch the debugger in the post-mortem mode if an application crashes on Windows. Click the Debug in Qt Creator button in the error message that is displayed by the Windows operating system.

Launching in On-device Mode

The on-device mode is a special mode available for run configurations targeting mobile devices. It debugs processes running on mobile devices using on-device debugging agents, such as CODA on Symbian and gdbserver on Linux-based devices.

To launch the debugger in the on-device mode, open the project, select a run configuration that targets a mobile device, and click the Start Debugging button.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 56
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Combiner licence, à propos et fermer d'une dernière manière

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtcreator-2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web