Qt Creator Windows Debugging: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Fix paths)
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Debugging executables built with the Microsoft Visual Studio compilers in Qt Creator=
{{LangSwitch}}
__NOTOC__
[[Category:Tools::QtCreator]]
This article describes the debugging of executables built with the Microsoft Visual Studio compilers in Qt Creator.
== Installation prerequisites ==


==Installation prerequisites==
Qt Creator uses the ''cdb.exe'' command line debugger provided with the ''Debugging Tools for Windows'' package as part of the ''Windows SDK''.


Qt Creator uses the ''cdb.exe'' command line debugger provided with the ''Debugging Tools for Windows'' package as part of the ''Windows <span class="caps">SDK</span>''.
As of ''Microsoft Visual Studio 2012'', the ''Windows Kit 8'' is installed along with Visual Studio, but cdb.exe is not included unless you check the ''Debugging Tools for Windows'' component in the installer. The debuggers are typically located in ''C:\Program Files (x86)\Windows Kits\8.0\Debugger''.


As of ''Microsoft Visual Studio 2012'', the ''Windows Kit 8'' is installed along with Visual Studio. Make sure you check the ''Debugging Tools for Windows'' component in the installer. The debuggers are typically located in ''c:\Program Files (x86)\Windows Kits\8.0\Debugger'' .
For the older ''Windows SDKs'', such as ''Windows SDK 7.1'', the ''Debugging Tools for Windows'' where shipped as a separate installer on the ISO-image of the SDKs. The debuggers are typically located in ''C:\Program Files (x86)\Debugging Tools for Windows'' or ''C:\Program Files\Debugging Tools for Windows'' .
 
For the older ''Windows <span class="caps">SDK</span>s'', such as ''Windows <span class="caps">SDK</span> 7.1'', the ''Debugging Tools for Windows'' where shipped as a separate installer on the <span class="caps">ISO</span>-image of the <span class="caps">SDK</span>s. The debuggers are typically located in ''c:\Program Files (x86)\Debugging Tools for Windows'' or ''c:\Program Files\Debugging Tools for Windows'' .


After installation, the debugger should be autodetected and show up in the Kit configuration. If it does not (due to non-standard installation paths), please point the Debugger kit configuration dialog to the location.
After installation, the debugger should be autodetected and show up in the Kit configuration. If it does not (due to non-standard installation paths), please point the Debugger kit configuration dialog to the location.
Line 13: Line 15:
The 32bit version of ''cdb.exe'' can only debug 32bit executables. The 64bit version can debug both 64bit and 32bit executables, however interrupting a 32bit executable with a 64bit debugger can result in a stacktrace of the Wow64 32bit emulation layer being displayed.
The 32bit version of ''cdb.exe'' can only debug 32bit executables. The 64bit version can debug both 64bit and 32bit executables, however interrupting a 32bit executable with a 64bit debugger can result in a stacktrace of the Wow64 32bit emulation layer being displayed.


Qt Creator extends the command line debugger by loading an extension library into it (''qtcreatorcdbext.dll''). This library must be provided for the 32bit and 64bit version of the debugger, in the folders ''libs\qtcreatorcdbext64'' or ''libs\qtcreatorcdbext32'' respectively. If you build a 32bit version of Qt Creator, the 64bit version of the <span class="caps">DLL</span> can be obtained from the [https://qt.gitorious.org/qt-creator/binary-artifacts Binary artifacts repository] ''[qt.gitorious.org]'' . This repository also contains the binary ''win64interrupt.exe'' which goes to the ''bin'' folder of Qt Creator and is used to interrupt 64bit executables from a 32bit-built Qt Creator.
Qt Creator extends the command line debugger by loading an extension library into it (''qtcreatorcdbext.dll''). This library must be provided for the 32bit and 64bit version of the debugger, in the folders ''libs\qtcreatorcdbext64'' or ''libs\qtcreatorcdbext32'' respectively. If you build a 32bit version of Qt Creator, the 64bit version of the DLL can be obtained from the [https://qt.gitorious.org/qt-creator/binary-artifacts Binary artifacts repository] . This repository also contains the binary ''win64interrupt.exe'' which goes to the ''bin'' folder of Qt Creator and is used to interrupt 64bit executables from a 32bit-built Qt Creator.


==Obtaining debugging information for operating system and compiler runtime libraries==
== Obtaining debugging information for operating system and compiler runtime libraries ==


When launching debugging for the first time, you are prompted to set up a [http://support.microsoft.com/kb/311503 Symbol server] ''[support.microsoft.com]'' , which adds a special entry to the symbol path of the debugger. The ''Symbol Server'' provides debugging information for operating system and compiler runtime libraries. The initial download can be time-consuming.
When launching debugging for the first time, you are prompted to set up a [http://support.microsoft.com/kb/311503 Symbol server] , which adds a special entry to the symbol path of the debugger. The ''Symbol Server'' provides debugging information for operating system and compiler runtime libraries. The initial download can be time-consuming.


==Tips &amp; Tricks==
== Tips & Tricks ==


When the debugger fails to launch, please verify first that you can run the application by pressing the ''Run'' button. It can happen that the target selector chooses a non-runnable target.
When the debugger fails to launch, please verify first that you can run the application by pressing the ''Run'' button. It can happen that the target selector chooses a non-runnable target.


2nd, take a look at the ''Debugger Log'' (choose ''Window/Views/Debugger log'' ). This usually shows errors. When reporting bugs related to debugging, please always attach the log. Note: Failing to start with error 135 reported usually means that a dependent <span class="caps">DLL</span> cannot be found.
2nd, take a look at the ''Debugger Log'' (choose ''Window/Views/Debugger log'' ). This usually shows errors. When reporting bugs related to debugging, please always attach the log. Note: Failing to start with error 135 reported usually means that a dependent DLL cannot be found.


In order to be able to view variables, etc, a debug build is required.
In order to be able to view variables, etc, a debug build is required.


Debugging can be slowed down by out-of-date ''.pdb'' files. A clean build can help. Also, incremental linking can affect debugging (check for “Unable to verify checksum of module…” in the log).
Debugging can be slowed down by out-of-date ''.pdb'' files. A clean build can help. Also, incremental linking can affect debugging (check for "Unable to verify checksum of module…" in the log).


Incremental linking can be disabled by adding
Incremental linking can be disabled by adding


to the compiler options.
<code>QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO </code>
 
===Categories:===
 
* [[:Category:Tools|Tools]]
** [[:Category:Tools::QtCreator|QtCreator]]

Revision as of 09:29, 19 October 2016

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

This article describes the debugging of executables built with the Microsoft Visual Studio compilers in Qt Creator.

Installation prerequisites

Qt Creator uses the cdb.exe command line debugger provided with the Debugging Tools for Windows package as part of the Windows SDK.

As of Microsoft Visual Studio 2012, the Windows Kit 8 is installed along with Visual Studio, but cdb.exe is not included unless you check the Debugging Tools for Windows component in the installer. The debuggers are typically located in C:\Program Files (x86)\Windows Kits\8.0\Debugger.

For the older Windows SDKs, such as Windows SDK 7.1, the Debugging Tools for Windows where shipped as a separate installer on the ISO-image of the SDKs. The debuggers are typically located in C:\Program Files (x86)\Debugging Tools for Windows or C:\Program Files\Debugging Tools for Windows .

After installation, the debugger should be autodetected and show up in the Kit configuration. If it does not (due to non-standard installation paths), please point the Debugger kit configuration dialog to the location.

The 32bit version of cdb.exe can only debug 32bit executables. The 64bit version can debug both 64bit and 32bit executables, however interrupting a 32bit executable with a 64bit debugger can result in a stacktrace of the Wow64 32bit emulation layer being displayed.

Qt Creator extends the command line debugger by loading an extension library into it (qtcreatorcdbext.dll). This library must be provided for the 32bit and 64bit version of the debugger, in the folders libs\qtcreatorcdbext64 or libs\qtcreatorcdbext32 respectively. If you build a 32bit version of Qt Creator, the 64bit version of the DLL can be obtained from the Binary artifacts repository . This repository also contains the binary win64interrupt.exe which goes to the bin folder of Qt Creator and is used to interrupt 64bit executables from a 32bit-built Qt Creator.

Obtaining debugging information for operating system and compiler runtime libraries

When launching debugging for the first time, you are prompted to set up a Symbol server , which adds a special entry to the symbol path of the debugger. The Symbol Server provides debugging information for operating system and compiler runtime libraries. The initial download can be time-consuming.

Tips & Tricks

When the debugger fails to launch, please verify first that you can run the application by pressing the Run button. It can happen that the target selector chooses a non-runnable target.

2nd, take a look at the Debugger Log (choose Window/Views/Debugger log ). This usually shows errors. When reporting bugs related to debugging, please always attach the log. Note: Failing to start with error 135 reported usually means that a dependent DLL cannot be found.

In order to be able to view variables, etc, a debug build is required.

Debugging can be slowed down by out-of-date .pdb files. A clean build can help. Also, incremental linking can affect debugging (check for "Unable to verify checksum of module…" in the log).

Incremental linking can be disabled by adding

QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO