diff options
author | Artem Sokolovskii <[email protected]> | 2023-07-04 16:32:37 +0200 |
---|---|---|
committer | Artem Sokolovskii <[email protected]> | 2023-07-14 08:47:01 +0000 |
commit | cd6e990de8a794735c9ca000b2cd0fd3668fbe08 (patch) | |
tree | 674556b5789b660abd4d1856e03f1942a146fa88 /src/plugins/debugger/debuggerplugin.cpp | |
parent | a5e773aeee40812cd4e8db88eda2521806ba40a4 (diff) |
DAP: Add CMake debug to the debug panel
This commit introduces the capability to initiate
CMake Debug sessions directly from the debug panel
in the QtCretor.
Change-Id: I00245e0e14aded378e881c4049cdc41dd1fbd00e
Reviewed-by: <[email protected]>
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/debugger/debuggerplugin.cpp')
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 152f928fb1e..b2d9e46595b 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -56,6 +56,7 @@ #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildmanager.h> +#include <projectexplorer/buildsystem.h> #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h> #include <projectexplorer/devicesupport/sshparameters.h> @@ -660,6 +661,7 @@ public: ProxyAction m_hiddenStopAction; QAction m_undisturbableAction; OptionalAction m_startAction; + OptionalAction m_startCmakeAction; QAction m_debugWithoutDeployAction{Tr::tr("Start Debugging Without Deployment")}; QAction m_startAndDebugApplicationAction{Tr::tr("Start and Debug External Application...")}; QAction m_attachToRunningApplication{Tr::tr("Attach to Running Application...")}; @@ -692,6 +694,7 @@ public: IContext m_debugModeContext; Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, Tr::tr("Debugger")}; + std::unique_ptr<Perspective> m_perspectiveCmake; DebuggerKitAspect debuggerKitAspect; CommonOptionsPage commonOptionsPage; @@ -838,6 +841,11 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments) ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, false); }); + connect(&m_startCmakeAction, &QAction::triggered, this, [] { +// ProjectTree::currentBuildSystem()->requestDebugging(); + ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::CMAKE_DEBUG_RUN_MODE, true); + }); + connect(&m_debugWithoutDeployAction, &QAction::triggered, this, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, true); }); @@ -1182,6 +1190,28 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments) m_perspective.addWindow(breakpointManagerWindow, Perspective::SplitHorizontal, engineManagerWindow); m_perspective.addWindow(globalLogWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea); + if (qEnvironmentVariableIsSet("QTC_USE_CMAKE_DEBUGGER")) { + m_perspectiveCmake = std::make_unique<Perspective>(Constants::CMAKE_PERSPECTIVE_ID, + Tr::tr("CMake")); + m_startCmakeAction.setText(Tr::tr("Start CMake Debugging")); + m_startCmakeAction.setEnabled(true); + m_startCmakeAction.setIcon(startIcon(true)); + m_startCmakeAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + m_startCmakeAction.setVisible(true); + + m_perspectiveCmake->addToolBarAction(&m_startCmakeAction); + + m_perspectiveCmake->addWindow(engineManagerWindow, Perspective::SplitVertical, nullptr); + m_perspectiveCmake->addWindow(breakpointManagerWindow, + Perspective::SplitHorizontal, + engineManagerWindow); + m_perspectiveCmake->addWindow(globalLogWindow, + Perspective::AddToTab, + nullptr, + false, + Qt::TopDockWidgetArea); + } + setInitialState(); connect(ProjectManager::instance(), &ProjectManager::startupProjectChanged, |