forked from qt-creator/qt-creator
Debugger: Choose right binary for CDB/gdb.
This commit is contained in:
@@ -634,10 +634,15 @@ bool CdbEngine::launchCDB(const DebuggerStartParameters &sp, QString *errorMessa
|
|||||||
qDebug("launchCDB startMode=%d", sp.startMode);
|
qDebug("launchCDB startMode=%d", sp.startMode);
|
||||||
const QChar blank(QLatin1Char(' '));
|
const QChar blank(QLatin1Char(' '));
|
||||||
// Start engine which will run until initial breakpoint:
|
// 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
|
// The extension is passed as relative name with the path variable set
|
||||||
//(does not work with absolute path names)
|
//(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()) {
|
if (executable.isEmpty()) {
|
||||||
*errorMessage = tr("There is no CDB executable specified.");
|
*errorMessage = tr("There is no CDB executable specified.");
|
||||||
return false;
|
return false;
|
||||||
|
@@ -222,16 +222,21 @@ DebuggerEngineType DebuggerRunControlPrivate::engineForMode
|
|||||||
|
|
||||||
static DebuggerEngineType engineForToolChain(const Abi &toolChain)
|
static DebuggerEngineType engineForToolChain(const Abi &toolChain)
|
||||||
{
|
{
|
||||||
if (toolChain.binaryFormat() == Abi::Format_ELF || toolChain.binaryFormat() == Abi::Format_Mach_O
|
switch (toolChain.binaryFormat()) {
|
||||||
|| (toolChain.binaryFormat() == Abi::Format_PE && toolChain.osFlavor() == Abi::Windows_msys)) {
|
case Abi::Format_ELF:
|
||||||
|
case Abi::Format_Mach_O:
|
||||||
#ifdef WITH_LLDB
|
#ifdef WITH_LLDB
|
||||||
// lldb override
|
// lldb override
|
||||||
if (Core::ICore::instance()->settings()->value("LLDB/enabled").toBool())
|
if (Core::ICore::instance()->settings()->value("LLDB/enabled").toBool())
|
||||||
return LldbEngineType;
|
return LldbEngineType;
|
||||||
#endif
|
#endif
|
||||||
return GdbEngineType;
|
return GdbEngineType;
|
||||||
} else if (toolChain.binaryFormat() == Abi::Format_PE && toolChain.osFlavor() != Abi::Windows_msys) {
|
case Abi::Format_PE:
|
||||||
return CdbEngineType;
|
if (toolChain.osFlavor() == Abi::Windows_msys)
|
||||||
|
return GdbEngineType;
|
||||||
|
return CdbEngineType;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return NoEngineType;
|
return NoEngineType;
|
||||||
}
|
}
|
||||||
@@ -280,9 +285,10 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
|
|||||||
if (sp.processArgs.startsWith(__("@tcf@ ")))
|
if (sp.processArgs.startsWith(__("@tcf@ ")))
|
||||||
engineType = GdbEngineType;
|
engineType = GdbEngineType;
|
||||||
|
|
||||||
if (engineType == NoEngineType
|
// Override CDB by gdb if no PDB sections are found in executable
|
||||||
&& sp.startMode != AttachToRemote
|
// (pending proper MinGW/MSys detection).
|
||||||
&& !sp.executable.isEmpty())
|
if ((engineType == NoEngineType || engineType == CdbEngineType)
|
||||||
|
&& sp.startMode != AttachToRemote && !sp.executable.isEmpty())
|
||||||
engineType = d->engineForExecutable(enabledEngineTypes, sp.executable);
|
engineType = d->engineForExecutable(enabledEngineTypes, sp.executable);
|
||||||
|
|
||||||
if (engineType == NoEngineType)
|
if (engineType == NoEngineType)
|
||||||
|
@@ -4207,8 +4207,17 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb,
|
|||||||
|
|
||||||
const DebuggerStartParameters &sp = startParameters();
|
const DebuggerStartParameters &sp = startParameters();
|
||||||
m_gdb = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_PATH"));
|
m_gdb = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_PATH"));
|
||||||
if (m_gdb.isEmpty() && sp.startMode != StartRemoteGdb)
|
if (m_gdb.isEmpty() && sp.startMode != StartRemoteGdb) {
|
||||||
m_gdb = debuggerCore()->debuggerForAbi(startParameters().toolChainAbi);
|
// 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())
|
if (m_gdb.isEmpty())
|
||||||
m_gdb = gdb;
|
m_gdb = gdb;
|
||||||
if (m_gdb.isEmpty()) {
|
if (m_gdb.isEmpty()) {
|
||||||
|
Reference in New Issue
Block a user