QtSupport: Try harder at providing the right debugger

... for a temporary kit created by the importer.
The way the importer works is that it sets up a random kit (with a
default toolchain) and then overwrites toolchain and Qt version. If the
new toolchain is of a different type than the original one, the debugger
will not match anymore. Fix this by calling fix() on the changed kit and
adapting the DebuggerKitAspect so that it sets itself up from scratch if
the current value doesn't match the toolchain.

Fixes: QTCREATORBUG-27758
Change-Id: Ib0539f07c0c38728de89a49299b7d2439afc5744
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2022-07-04 16:41:46 +02:00
parent 3852b89d02
commit c04f3a94ea
2 changed files with 12 additions and 1 deletions

View File

@@ -264,11 +264,21 @@ void DebuggerKitAspect::fix(Kit *k)
return; return;
if (rawId.type() == QVariant::String) { if (rawId.type() == QVariant::String) {
if (!DebuggerItemManager::findById(rawId)) { const DebuggerItem * const item = DebuggerItemManager::findById(rawId);
if (!item) {
qWarning("Unknown debugger id %s in kit %s", qWarning("Unknown debugger id %s in kit %s",
qPrintable(rawId.toString()), qPrintable(k->displayName())); qPrintable(rawId.toString()), qPrintable(k->displayName()));
k->setValue(DebuggerKitAspect::id(), QVariant()); k->setValue(DebuggerKitAspect::id(), QVariant());
setup(k);
return;
} }
const Abi tcAbi = ToolChainKitAspect::targetAbi(k);
for (const Abi &abi : item->abis()) {
if (abi.isCompatibleWith(tcAbi))
return;
}
k->setValue(DebuggerKitAspect::id(), QVariant());
setup(k);
return; // All fine (now). return; // All fine (now).
} }

View File

@@ -90,6 +90,7 @@ Kit *QtProjectImporter::createTemporaryKit(const QtVersionData &versionData,
} }
additionalSetup(k); additionalSetup(k);
k->fix();
}); });
} }