diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index d26f25159a86e896860ed60818485d9a36ce8dbb..a9e836bc9b3f83cfe62f784b6551b73ba11d3475 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -634,10 +634,15 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa qDebug("launchCDB startMode=%d", sp.startMode); const QChar blank(QLatin1Char(' ')); // Start engine which will run until initial breakpoint: - // Determine extension lib name and path to use + // Determine binary (force MSVC), extension lib name and path to use // The extension is passed as relative name with the path variable set //(does not work with absolute path names) - const QString executable = debuggerCore()->debuggerForAbi(sp.toolChainAbi); + ProjectExplorer::Abi abi = sp.toolChainAbi; + if (abi.osFlavor() == ProjectExplorer::Abi::UNKNOWN_OSFLAVOUR || abi.osFlavor() == ProjectExplorer::Abi::Windows_msys) + abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), + ProjectExplorer::Abi::Windows_msvc, + abi.binaryFormat(), abi.wordWidth()); + const QString executable = debuggerCore()->debuggerForAbi(abi); if (executable.isEmpty()) { *errorMessage = tr("There is no CDB executable specified."); return false; diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 5bc6cf1505ce6322195fcd7189e2e76c273e0ffd..5ddd97cc32123f5bab734e4071d3ad741a517591 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -222,16 +222,21 @@ DebuggerEngineType DebuggerRunControlPrivate::engineForMode static DebuggerEngineType engineForToolChain(const Abi &toolChain) { - if (toolChain.binaryFormat() == Abi::Format_ELF || toolChain.binaryFormat() == Abi::Format_Mach_O - || (toolChain.binaryFormat() == Abi::Format_PE && toolChain.osFlavor() == Abi::Windows_msys)) { + switch (toolChain.binaryFormat()) { + case Abi::Format_ELF: + case Abi::Format_Mach_O: #ifdef WITH_LLDB // lldb override if (Core::ICore::instance()->settings()->value("LLDB/enabled").toBool()) return LldbEngineType; #endif return GdbEngineType; - } else if (toolChain.binaryFormat() == Abi::Format_PE && toolChain.osFlavor() != Abi::Windows_msys) { - return CdbEngineType; + case Abi::Format_PE: + if (toolChain.osFlavor() == Abi::Windows_msys) + return GdbEngineType; + return CdbEngineType; + default: + break; } return NoEngineType; } @@ -280,9 +285,10 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, if (sp.processArgs.startsWith(__("@tcf@ "))) engineType = GdbEngineType; - if (engineType == NoEngineType - && sp.startMode != AttachToRemote - && !sp.executable.isEmpty()) + // Override CDB by gdb if no PDB sections are found in executable + // (pending proper MinGW/MSys detection). + if ((engineType == NoEngineType || engineType == CdbEngineType) + && sp.startMode != AttachToRemote && !sp.executable.isEmpty()) engineType = d->engineForExecutable(enabledEngineTypes, sp.executable); if (engineType == NoEngineType) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 85bb5dd4b62b0661cfaf110385d3a859b62c1e24..02f1832149fda8f12d4f0bac0f49a98e38872fb7 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4207,8 +4207,17 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const DebuggerStartParameters &sp = startParameters(); m_gdb = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_PATH")); - if (m_gdb.isEmpty() && sp.startMode != StartRemoteGdb) - m_gdb = debuggerCore()->debuggerForAbi(startParameters().toolChainAbi); + if (m_gdb.isEmpty() && sp.startMode != StartRemoteGdb) { + // We want the MinGW gdb also in case we got started using some compatible ABI. + ProjectExplorer::Abi abi = startParameters().toolChainAbi; + if (abi.os() == ProjectExplorer::Abi::Windows) { + if (abi.osFlavor() == ProjectExplorer::Abi::UNKNOWN_OSFLAVOUR || abi.osFlavor() == ProjectExplorer::Abi::Windows_msvc) + abi = ProjectExplorer::Abi(abi.architecture(), abi.os(), + ProjectExplorer::Abi::Windows_msys, + abi.binaryFormat(), abi.wordWidth()); + } + m_gdb = debuggerCore()->debuggerForAbi(abi); + } if (m_gdb.isEmpty()) m_gdb = gdb; if (m_gdb.isEmpty()) {