Qt Creator Windows Debugging: Difference between revisions
Fix paths |
Removed outdated references to WinSDK 7 / 8 and replace it with the current link to the debugger tools |
||
| (7 intermediate revisions by 4 users not shown) | |||
| Line 3: | Line 3: | ||
[[Category:Tools::QtCreator]] | [[Category:Tools::QtCreator]] | ||
This article describes the debugging of executables built with the Microsoft Visual Studio compilers in Qt Creator. | 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 SDK''. | ||
See https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools on how to download and install the debugger. | |||
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. | |||
The | ==Debugging x64 on Windows 11 Arm64 host== | ||
The <code>Windows Software Development Kit - Windows 10.0.22000.194</code> which is the current Windows 11 SDK doesn't install on a Windows 11 Arm64 host the <code>%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x64</code> directory, wich would host the <code>cdb.exe</code> needed for debugging <code>x64</code> applications. | |||
Windows 11 SDK does actually deliver the redistributable x64 installer <code>%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi</code>, which when executed will install and make the <code>x64 cdb.exe</code> available. | |||
'''Note''' that you will have to install the above <code>msi</code> package from a <code>x64</code> application (e.g. Total Commander or Qt Creator itself) and '''not''' from Windows Explorer (<code>arm64</code> application). | |||
Starting with <code>Windows 11 22H2</code> you can automate the installation of the <code>x64 cdb.exe</code> as: | |||
1. Uninstall the arm64 broken installation: | |||
%comspec% /q /c start /machine arm64 %windir%\System32\msiexec.exe /uninstall "%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi" | |||
2. Install the correct x64 (amd64) package: | |||
%comspec% /q /c start /machine amd64 %windir%\System32\msiexec.exe /i "%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi" | |||
For more details have a look at: https://bugreports.qt.io/browse/QTCREATORBUG-26934 | |||
== 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] , 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 & 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. | ||
| Line 31: | Line 43: | ||
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 the following line to the CMakeList.txt file when building with CMake: | ||
<code>set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO" )</code> | |||
Or the following line to the .pro file when building with qmake: | |||
<code>QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO </code> | <code>QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO </code> | ||
<br /> | |||
Latest revision as of 12:44, 10 April 2026
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.
See https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools on how to download and install the debugger.
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.
Debugging x64 on Windows 11 Arm64 host
The <code>Windows Software Development Kit - Windows 10.0.22000.194</code> which is the current Windows 11 SDK doesn't install on a Windows 11 Arm64 host the <code>%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x64</code> directory, wich would host the <code>cdb.exe</code> needed for debugging <code>x64</code> applications.
Windows 11 SDK does actually deliver the redistributable x64 installer <code>%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi</code>, which when executed will install and make the <code>x64 cdb.exe</code> available.
Note that you will have to install the above <code>msi</code> package from a <code>x64</code> application (e.g. Total Commander or Qt Creator itself) and not from Windows Explorer (<code>arm64</code> application).
Starting with <code>Windows 11 22H2</code> you can automate the installation of the <code>x64 cdb.exe</code> as:
1. Uninstall the arm64 broken installation:
%comspec% /q /c start /machine arm64 %windir%\System32\msiexec.exe /uninstall "%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi"
2. Install the correct x64 (amd64) package:
%comspec% /q /c start /machine amd64 %windir%\System32\msiexec.exe /i "%ProgramFiles(x86)%\Windows Kits\10\Debuggers\Redist\X64 Debuggers And Tools-x64_en-us.msi"
For more details have a look at: https://bugreports.qt.io/browse/QTCREATORBUG-26934
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 the following line to the CMakeList.txt file when building with CMake:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO" )
Or the following line to the .pro file when building with qmake:
QMAKE_LFLAGS_DEBUG += /INCREMENTAL:NO