Commit fa6fbcc8 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Choose right binary for CDB/gdb.

parent e95bda96
......@@ -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;
......
......@@ -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)
......
......@@ -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()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment