From 795d4506e6be0c2986dc683f7d8be4545dcb06ee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Tue, 9 Aug 2011 10:38:30 +0200 Subject: [PATCH] Debugger: Fix MSVC detection. Trigger AttachCore for MSVC flavours only. Handle .dmp files on the command line. Change-Id: I65be1ad7aef36db157a84499ff5e10d9f1e8fb97 Reviewed-on: http://codereview.qt.nokia.com/2766 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> --- src/plugins/debugger/cdb/cdbengine.cpp | 16 ++++++++++------ src/plugins/debugger/debuggerplugin.cpp | 7 +++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index ba13c1dc978..c10699f76c2 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -357,14 +357,19 @@ static inline QString msgNoCdbBinaryForToolChain(const ProjectExplorer::Abi &tc) return CdbEngine::tr("There is no CDB binary available for binaries in format '%1'").arg(tc.toString()); } +static inline bool isMSVC_Flavor(ProjectExplorer::Abi::OSFlavor osf) +{ + return osf == ProjectExplorer::Abi::WindowsMsvc2005Flavor + || osf == ProjectExplorer::Abi::WindowsMsvc2008Flavor + || osf == ProjectExplorer::Abi::WindowsMsvc2010Flavor; +} + static QString cdbBinary(const DebuggerStartParameters &sp) { if (!sp.debuggerCommand.isEmpty()) { // Do not use a GDB binary if we got started for a project with MinGW runtime. const bool abiMatch = sp.toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS - && (sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor - || sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor - || sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor); + && isMSVC_Flavor(sp.toolChainAbi.osFlavor()); if (abiMatch) return sp.debuggerCommand; } @@ -393,9 +398,8 @@ bool checkCdbConfiguration(const DebuggerStartParameters &sp, ConfigurationCheck return false; } - if (sp.toolChainAbi.osFlavor() == Abi::WindowsMSysFlavor - && sp.startMode == AttachCore) { - check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine cannot debug MSys core files.")); + if (sp.startMode == AttachCore && !isMSVC_Flavor(sp.toolChainAbi.osFlavor()) { + check->errorDetails.push_back(CdbEngine::tr("The CDB debug engine cannot debug gdb core files.")); return false; } diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 60cfc311a60..7602dd062d4 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1213,8 +1213,11 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, sp.toolChainAbi = anyAbiOfBinary(sp.executable); } else { // Fixme: Distinguish between core-file and executable by argument syntax? - // (default up to 2.2 was core-file). - if (Abi::hostAbi().os() == Abi::WindowsOS || QFileInfo(*it).isExecutable()) { + // (default up to 2.2 was core-file (".dmp on Windows)). + const bool isExecutable = Abi::hostAbi().os() == Abi::WindowsOS ? + !it->endsWith(QLatin1String(".dmp"), Qt::CaseInsensitive) : + QFileInfo(*it).isExecutable(); + if (isExecutable) { sp.startMode = StartExternal; sp.executable = *it; sp.displayName = tr("Executable file \"%1\"").arg(sp.executable); -- GitLab