From 818bb51b0841dabe0561956c4579c2be8206d22e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 23 Mar 2012 13:00:09 +0100 Subject: [PATCH] Autodetect CDB's shipped with Windows Kits >= 8.0. Task-number: QTCREATORBUG-7182 Change-Id: I153788664067445cece3c7ecf46cf8217539251d Reviewed-by: hjk Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/msvctoolchain.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index a73f04eb959..74e0f1ffae0 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -646,6 +647,7 @@ QList MsvcToolChainFactory::autoDetect() return results; } +// Detect CDB, return a pair of <32bit, 64bit> executables. QPair MsvcToolChain::autoDetectCdbDebugger() { QPair result; @@ -660,6 +662,29 @@ QPair MsvcToolChain::autoDetectCdbDebugger() if (dirName.isEmpty()) continue; QDir dir(dirName); + // Windows SDK's starting from version 8 live in + // "ProgramDir\Windows Kits\" + const QString windowsKitsFolderName = QLatin1String("Windows Kits"); + if (dir.exists(windowsKitsFolderName)) { + QDir windowKitsFolder = dir; + if (windowKitsFolder.cd(windowsKitsFolderName)) { + // Check in reverse order (latest first) + const QFileInfoList kitFolders = + windowKitsFolder.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, + QDir::Time|QDir::Reversed); + foreach (const QFileInfo &kitFolderFi, kitFolders) { + const QString path = kitFolderFi.absoluteFilePath(); + const QFileInfo cdb32(path + QLatin1String("/Debuggers/x86/cdb.exe")); + if (cdb32.isExecutable()) + cdbs.push_back(Utils::FileName::fromString(cdb32.absoluteFilePath())); + const QFileInfo cdb64(path + QLatin1String("/Debuggers/x64/cdb.exe")); + if (cdb64.isExecutable()) + cdbs.push_back(Utils::FileName::fromString(cdb64.absoluteFilePath())); + } // for Kits + } // can cd to "Windows Kits" + } // "Windows Kits" exists + + // Pre Windows SDK 8: Check 'Debugging Tools for Windows' foreach (const QFileInfo &fi, dir.entryInfoList(QStringList(QLatin1String("Debugging Tools for Windows*")), QDir::Dirs | QDir::NoDotAndDotDot)) { Utils::FileName filePath(fi);