From b4eb6ff4dda15e10d79c46a669f1586ea8fdeb36 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Tue, 30 Nov 2021 16:13:11 +0100 Subject: [PATCH] McuSupport: fix armgdb registration when creating kit Task-number: QTCREATORBUG-26631 Change-Id: Ia1854ba2a4d34afff1d2c80aac4c9919cd3142dc Reviewed-by: Erik Verbruggen Reviewed-by: Qt CI Bot Reviewed-by: Alessandro Portale --- src/plugins/mcusupport/mcusupportoptions.cpp | 32 +++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 4a21ece87bc..4c9c7dab27d 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -497,8 +497,27 @@ QVariant McuToolChainPackage::debuggerId() const { using namespace Debugger; - QString sub = QString::fromLatin1(m_type == TypeArmGcc ? "bin/arm-none-eabi-gdb-py" - : m_type == TypeIAR ? "../common/bin/CSpyBat" : "bar/foo-keil-gdb"); + QString sub, displayName; + DebuggerEngineType engineType; + + switch (m_type) { + case TypeArmGcc: { + sub = QString::fromLatin1("bin/arm-none-eabi-gdb-py"); + displayName = McuPackage::tr("Arm GDB at %1"); + engineType = Debugger::GdbEngineType; + break; } + case TypeIAR: { + sub = QString::fromLatin1("../common/bin/CSpyBat"); + displayName = QLatin1String("CSpy"); + engineType = Debugger::NoEngineType; // support for IAR missing + break; } + case TypeKEIL: { + sub = QString::fromLatin1("UV4/UV4"); + displayName = QLatin1String("KEIL uVision Debugger"); + engineType = Debugger::UvscEngineType; + break; } + default: return QVariant(); + } const FilePath command = path().pathAppended(sub).withExecutableSuffix(); const DebuggerItem *debugger = DebuggerItemManager::findByCommand(command); @@ -506,11 +525,8 @@ QVariant McuToolChainPackage::debuggerId() const if (!debugger) { DebuggerItem newDebugger; newDebugger.setCommand(command); - const QString displayName = m_type == TypeArmGcc - ? McuPackage::tr("Arm GDB at %1") - : m_type == TypeIAR ? QLatin1String("CSpy") - : QLatin1String("/bar/foo-keil-gdb"); newDebugger.setUnexpandedDisplayName(displayName.arg(command.toUserOutput())); + newDebugger.setEngineType(engineType); debuggerId = DebuggerItemManager::registerDebugger(newDebugger); } else { debuggerId = debugger->id(); @@ -743,7 +759,9 @@ static void setKitDebugger(Kit *k, const McuToolChainPackage *tcPackage) || tcPackage->type() == McuToolChainPackage::TypeIAR) return; - Debugger::DebuggerKitAspect::setDebugger(k, tcPackage->debuggerId()); + const QVariant debuggerId = tcPackage->debuggerId(); + if (debuggerId.isValid()) + Debugger::DebuggerKitAspect::setDebugger(k, debuggerId); } static void setKitDevice(Kit *k, const McuTarget* mcuTarget)