summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2019-10-18 12:04:43 +0200
committerAlessandro Portale <alessandro.portale@qt.io>2019-10-18 10:56:25 +0000
commitb5942847e2ec7f850dea35189197e0ea54c6bc0e (patch)
tree6c8b65212bb0422aef76164d02330f9243504dfc
parentf723531f8fc255e733f65df99c2ac1da3c9c0743 (diff)
downloadqt-creator-b5942847e2ec7f850dea35189197e0ea54c6bc0e.tar.gz
McuSupport: Set ARM debugger in MCU kits
... create one if necessary. Change-Id: I0b89d54429834db7b76be0a76d260152efd1ad03 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/mcusupport/CMakeLists.txt2
-rw-r--r--src/plugins/mcusupport/mcusupport.qbs2
-rw-r--r--src/plugins/mcusupport/mcusupport_dependencies.pri1
-rw-r--r--src/plugins/mcusupport/mcusupportoptionspage.cpp29
4 files changed, 30 insertions, 4 deletions
diff --git a/src/plugins/mcusupport/CMakeLists.txt b/src/plugins/mcusupport/CMakeLists.txt
index deed8605ae..91fa58b620 100644
--- a/src/plugins/mcusupport/CMakeLists.txt
+++ b/src/plugins/mcusupport/CMakeLists.txt
@@ -1,6 +1,6 @@
add_qtc_plugin(McuSupport
DEPENDS Qt5::Core
- PLUGIN_DEPENDS Core ProjectExplorer CMakeProjectManager
+ PLUGIN_DEPENDS Core ProjectExplorer Debugger CMakeProjectManager
SOURCES
mcusupport.qrc
mcusupport_global.h
diff --git a/src/plugins/mcusupport/mcusupport.qbs b/src/plugins/mcusupport/mcusupport.qbs
index cb8ef1afce..732ecf81e4 100644
--- a/src/plugins/mcusupport/mcusupport.qbs
+++ b/src/plugins/mcusupport/mcusupport.qbs
@@ -9,8 +9,8 @@ QtcPlugin {
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
+ Depends { name: "Debugger" }
Depends { name: "CMakeProjectManager" }
- Depends { name: "QtSupport" }
files: [
"mcusupport.qrc",
diff --git a/src/plugins/mcusupport/mcusupport_dependencies.pri b/src/plugins/mcusupport/mcusupport_dependencies.pri
index b6fd4f9e6b..1f2dd5bc64 100644
--- a/src/plugins/mcusupport/mcusupport_dependencies.pri
+++ b/src/plugins/mcusupport/mcusupport_dependencies.pri
@@ -7,4 +7,5 @@ QTC_LIB_DEPENDS += \
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer \
+ debugger \
cmakeprojectmanager
diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp
index da1bf9f0d9..f83e015b8e 100644
--- a/src/plugins/mcusupport/mcusupportoptionspage.cpp
+++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp
@@ -28,6 +28,9 @@
#include <coreplugin/icore.h>
#include <cmakeprojectmanager/cmakekitinformation.h>
+#include <debugger/debuggeritem.h>
+#include <debugger/debuggeritemmanager.h>
+#include <debugger/debuggerkitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
@@ -623,6 +626,27 @@ static void setKitToolchains(ProjectExplorer::Kit *k, const QString &armGccPath)
ToolChainKitAspect::setToolChain(k, cxxTc);
}
+static void setKitDebugger(ProjectExplorer::Kit *k, const QString &armGccPath)
+{
+ using namespace Debugger;
+
+ const Utils::FilePath command = Utils::FilePath::fromUserInput(
+ Utils::HostOsInfo::withExecutableSuffix(armGccPath + "/bin/arm-none-eabi-gdb-py"));
+ const DebuggerItem *debugger = DebuggerItemManager::findByCommand(command);
+ QVariant debuggerId;
+ if (!debugger) {
+ DebuggerItem newDebugger;
+ newDebugger.setCommand(command);
+ newDebugger.setUnexpandedDisplayName(
+ McuSupportOptionsPage::tr("Arm GDB at %1").arg(command.toUserOutput()));
+ debuggerId = DebuggerItemManager::registerDebugger(newDebugger);
+ } else {
+ debuggerId = debugger->id();
+ }
+
+ DebuggerKitAspect::setDebugger(k, debuggerId);
+}
+
static void setKitDevice(ProjectExplorer::Kit *k)
{
using namespace ProjectExplorer;
@@ -650,7 +674,7 @@ static void setKitEnvironment(ProjectExplorer::Kit *k, const BoardOptions* board
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
}
-static void setCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board)
+static void setKitCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board)
{
using namespace CMakeProjectManager;
@@ -674,9 +698,10 @@ static ProjectExplorer::Kit* boardKit(const BoardOptions* board, const QString &
setKitProperties(k, board);
setKitToolchains(k, armGccPath);
+ setKitDebugger(k, armGccPath);
setKitDevice(k);
setKitEnvironment(k, board);
- setCMakeOptions(k, board);
+ setKitCMakeOptions(k, board);
k->setup();
k->fix();