Debugger: Rework detection of SDK-specified "auto" debuggers

Change-Id: I173752a41da7b34d64cb7e3e423992be464fc73b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-10-17 12:48:16 +02:00
parent ed9752bc0a
commit 16cf6177d8
3 changed files with 181 additions and 176 deletions

View File

@@ -185,6 +185,42 @@ void DebuggerItem::setAbi(const Abi &abi)
m_abis.append(abi);
}
static DebuggerItem::MatchLevel matchSingle(const Abi &debuggerAbi, const Abi &targetAbi)
{
if (debuggerAbi.architecture() != targetAbi.architecture())
return DebuggerItem::DoesNotMatch;
if (debuggerAbi.os() != targetAbi.os())
return DebuggerItem::DoesNotMatch;
if (debuggerAbi.binaryFormat() != targetAbi.binaryFormat())
return DebuggerItem::DoesNotMatch;
if (debuggerAbi.wordWidth() != targetAbi.wordWidth())
return DebuggerItem::DoesNotMatch;
if (debuggerAbi.os() == Abi::WindowsOS) {
if (debuggerAbi.osFlavor() == Abi::WindowsMSysFlavor && targetAbi.osFlavor() != Abi::WindowsMSysFlavor)
return DebuggerItem::DoesNotMatch;
if (debuggerAbi.osFlavor() != Abi::WindowsMSysFlavor && targetAbi.osFlavor() == Abi::WindowsMSysFlavor)
return DebuggerItem::DoesNotMatch;
return DebuggerItem::MatchesSomewhat;
}
return DebuggerItem::MatchesPerfectly;
}
DebuggerItem::MatchLevel DebuggerItem::matchTarget(const Abi &targetAbi) const
{
MatchLevel bestMatch = DoesNotMatch;
foreach (const Abi &debuggerAbi, m_abis) {
MatchLevel currentMatch = matchSingle(debuggerAbi, targetAbi);
if (currentMatch > bestMatch)
bestMatch = currentMatch;
}
return bestMatch;
}
bool Debugger::DebuggerItem::isValid() const
{
return m_engineType != NoEngineType;