From c04f3a94ea12a40e776b0a2830a984828fbb1401 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 4 Jul 2022 16:41:46 +0200 Subject: [PATCH] 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: Reviewed-by: David Schulz Reviewed-by: hjk --- src/plugins/debugger/debuggerkitinformation.cpp | 12 +++++++++++- src/plugins/qtsupport/qtprojectimporter.cpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerkitinformation.cpp b/src/plugins/debugger/debuggerkitinformation.cpp index 1af1f95486a..868cf947a01 100644 --- a/src/plugins/debugger/debuggerkitinformation.cpp +++ b/src/plugins/debugger/debuggerkitinformation.cpp @@ -264,11 +264,21 @@ void DebuggerKitAspect::fix(Kit *k) return; 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", qPrintable(rawId.toString()), qPrintable(k->displayName())); 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). } diff --git a/src/plugins/qtsupport/qtprojectimporter.cpp b/src/plugins/qtsupport/qtprojectimporter.cpp index 8b177d2e167..219b546608d 100644 --- a/src/plugins/qtsupport/qtprojectimporter.cpp +++ b/src/plugins/qtsupport/qtprojectimporter.cpp @@ -90,6 +90,7 @@ Kit *QtProjectImporter::createTemporaryKit(const QtVersionData &versionData, } additionalSetup(k); + k->fix(); }); }