forked from qt-creator/qt-creator
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: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -115,6 +115,7 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
|
|||||||
&CMakeBuildSystem::handleParsingSucceeded);
|
&CMakeBuildSystem::handleParsingSucceeded);
|
||||||
connect(&m_reader, &FileApiReader::errorOccurred, this, &CMakeBuildSystem::handleParsingFailed);
|
connect(&m_reader, &FileApiReader::errorOccurred, this, &CMakeBuildSystem::handleParsingFailed);
|
||||||
connect(&m_reader, &FileApiReader::dirty, this, &CMakeBuildSystem::becameDirty);
|
connect(&m_reader, &FileApiReader::dirty, this, &CMakeBuildSystem::becameDirty);
|
||||||
|
connect(&m_reader, &FileApiReader::debuggingStarted, this, &BuildSystem::debuggingStarted);
|
||||||
|
|
||||||
wireUpConnections();
|
wireUpConnections();
|
||||||
|
|
||||||
@@ -193,7 +194,15 @@ void CMakeBuildSystem::triggerParsing()
|
|||||||
qCDebug(cmakeBuildSystemLog) << "Asking reader to parse";
|
qCDebug(cmakeBuildSystemLog) << "Asking reader to parse";
|
||||||
m_reader.parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN,
|
m_reader.parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN,
|
||||||
reparseParameters & REPARSE_FORCE_INITIAL_CONFIGURATION,
|
reparseParameters & REPARSE_FORCE_INITIAL_CONFIGURATION,
|
||||||
reparseParameters & REPARSE_FORCE_EXTRA_CONFIGURATION);
|
reparseParameters & REPARSE_FORCE_EXTRA_CONFIGURATION,
|
||||||
|
reparseParameters & REPARSE_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildSystem::requestDebugging()
|
||||||
|
{
|
||||||
|
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to \"Rescan Project\" command";
|
||||||
|
reparse(REPARSE_FORCE_CMAKE_RUN | REPARSE_FORCE_EXTRA_CONFIGURATION | REPARSE_URGENT
|
||||||
|
| REPARSE_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
|
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
|
||||||
|
@@ -40,6 +40,7 @@ public:
|
|||||||
~CMakeBuildSystem() final;
|
~CMakeBuildSystem() final;
|
||||||
|
|
||||||
void triggerParsing() final;
|
void triggerParsing() final;
|
||||||
|
void requestDebugging() final;
|
||||||
|
|
||||||
bool supportsAction(ProjectExplorer::Node *context,
|
bool supportsAction(ProjectExplorer::Node *context,
|
||||||
ProjectExplorer::ProjectAction action,
|
ProjectExplorer::ProjectAction action,
|
||||||
@@ -143,6 +144,7 @@ private:
|
|||||||
= (1 << 1), // Force initial configuration arguments to cmake
|
= (1 << 1), // Force initial configuration arguments to cmake
|
||||||
REPARSE_FORCE_EXTRA_CONFIGURATION = (1 << 2), // Force extra configuration arguments to cmake
|
REPARSE_FORCE_EXTRA_CONFIGURATION = (1 << 2), // Force extra configuration arguments to cmake
|
||||||
REPARSE_URGENT = (1 << 3), // Do not delay the parser run by 1s
|
REPARSE_URGENT = (1 << 3), // Do not delay the parser run by 1s
|
||||||
|
REPARSE_DEBUG = (1 << 4), // Start with debugging
|
||||||
};
|
};
|
||||||
void reparse(int reparseParameters);
|
void reparse(int reparseParameters);
|
||||||
QString reparseParametersString(int reparseFlags);
|
QString reparseParametersString(int reparseFlags);
|
||||||
|
@@ -122,8 +122,9 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
|||||||
m_process->setWorkingDirectory(buildDirectory);
|
m_process->setWorkingDirectory(buildDirectory);
|
||||||
m_process->setEnvironment(parameters.environment);
|
m_process->setEnvironment(parameters.environment);
|
||||||
|
|
||||||
m_process->setStdOutLineCallback([](const QString &s) {
|
m_process->setStdOutLineCallback([this](const QString &s) {
|
||||||
BuildSystem::appendBuildSystemOutput(stripTrailingNewline(s));
|
BuildSystem::appendBuildSystemOutput(stripTrailingNewline(s));
|
||||||
|
emit stdOutReady(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_process->setStdErrLineCallback([this](const QString &s) {
|
m_process->setStdErrLineCallback([this](const QString &s) {
|
||||||
@@ -139,19 +140,6 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
|||||||
commandLine.addArgs({"-S", sourceDirectory.path(), "-B", buildDirectory.path()});
|
commandLine.addArgs({"-S", sourceDirectory.path(), "-B", buildDirectory.path()});
|
||||||
commandLine.addArgs(arguments);
|
commandLine.addArgs(arguments);
|
||||||
|
|
||||||
if (qEnvironmentVariableIsSet("QTC_USE_CMAKE_DEBUGGER")) {
|
|
||||||
FilePath file = FilePath::fromString("/tmp/cmake-dap.sock");
|
|
||||||
file.removeFile();
|
|
||||||
commandLine.addArgs({"--debugger", "--debugger-pipe=/tmp/cmake-dap.sock"});
|
|
||||||
connect(m_process.get(), &Process::started, this, [this, cmakeExecutable] {
|
|
||||||
QMetaObject::invokeMethod(debuggerPlugin(),
|
|
||||||
"attachToProcess",
|
|
||||||
Qt::QueuedConnection,
|
|
||||||
Q_ARG(qint64, m_process->processId()),
|
|
||||||
Q_ARG(const Utils::FilePath &, cmakeExecutable));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
|
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
|
||||||
|
|
||||||
BuildSystem::startNewBuildSystemOutput(::CMakeProjectManager::Tr::tr("Running %1 in %2.")
|
BuildSystem::startNewBuildSystemOutput(::CMakeProjectManager::Tr::tr("Running %1 in %2.")
|
||||||
|
@@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished(int exitCode);
|
void finished(int exitCode);
|
||||||
|
void stdOutReady(const QString &s);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleProcessDone(const Utils::ProcessResultData &resultData);
|
void handleProcessDone(const Utils::ProcessResultData &resultData);
|
||||||
|
@@ -82,19 +82,26 @@ void FileApiReader::resetData()
|
|||||||
|
|
||||||
void FileApiReader::parse(bool forceCMakeRun,
|
void FileApiReader::parse(bool forceCMakeRun,
|
||||||
bool forceInitialConfiguration,
|
bool forceInitialConfiguration,
|
||||||
bool forceExtraConfiguration)
|
bool forceExtraConfiguration,
|
||||||
|
bool debugging)
|
||||||
{
|
{
|
||||||
qCDebug(cmakeFileApiMode) << "Parse called with arguments: ForceCMakeRun:" << forceCMakeRun
|
qCDebug(cmakeFileApiMode) << "Parse called with arguments: ForceCMakeRun:" << forceCMakeRun
|
||||||
<< " - forceConfiguration:" << forceInitialConfiguration
|
<< " - forceConfiguration:" << forceInitialConfiguration
|
||||||
<< " - forceExtraConfiguration:" << forceExtraConfiguration;
|
<< " - forceExtraConfiguration:" << forceExtraConfiguration;
|
||||||
startState();
|
startState();
|
||||||
|
|
||||||
const QStringList args = (forceInitialConfiguration ? m_parameters.initialCMakeArguments
|
QStringList args = (forceInitialConfiguration ? m_parameters.initialCMakeArguments
|
||||||
: QStringList())
|
: QStringList())
|
||||||
+ (forceExtraConfiguration
|
+ (forceExtraConfiguration
|
||||||
? (m_parameters.configurationChangesArguments
|
? (m_parameters.configurationChangesArguments
|
||||||
+ m_parameters.additionalCMakeArguments)
|
+ m_parameters.additionalCMakeArguments)
|
||||||
: QStringList());
|
: QStringList());
|
||||||
|
if (debugging) {
|
||||||
|
FilePath file = FilePath::fromString("/tmp/cmake-dap.sock");
|
||||||
|
file.removeFile();
|
||||||
|
args << "--debugger" << "--debugger-pipe=/tmp/cmake-dap.sock";
|
||||||
|
}
|
||||||
|
|
||||||
qCDebug(cmakeFileApiMode) << "Parameters request these CMake arguments:" << args;
|
qCDebug(cmakeFileApiMode) << "Parameters request these CMake arguments:" << args;
|
||||||
|
|
||||||
const FilePath replyFile = FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory);
|
const FilePath replyFile = FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory);
|
||||||
@@ -339,6 +346,10 @@ void FileApiReader::startCMakeState(const QStringList &configurationArguments)
|
|||||||
m_cmakeProcess = std::make_unique<CMakeProcess>();
|
m_cmakeProcess = std::make_unique<CMakeProcess>();
|
||||||
|
|
||||||
connect(m_cmakeProcess.get(), &CMakeProcess::finished, this, &FileApiReader::cmakeFinishedState);
|
connect(m_cmakeProcess.get(), &CMakeProcess::finished, this, &FileApiReader::cmakeFinishedState);
|
||||||
|
connect(m_cmakeProcess.get(), &CMakeProcess::stdOutReady, this, [this](const QString &data) {
|
||||||
|
if (data.endsWith("Waiting for debugger client to connect...\n"))
|
||||||
|
emit debuggingStarted();
|
||||||
|
});
|
||||||
|
|
||||||
qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments;
|
qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments;
|
||||||
// Reset watcher:
|
// Reset watcher:
|
||||||
|
@@ -38,7 +38,10 @@ public:
|
|||||||
void setParameters(const BuildDirParameters &p);
|
void setParameters(const BuildDirParameters &p);
|
||||||
|
|
||||||
void resetData();
|
void resetData();
|
||||||
void parse(bool forceCMakeRun, bool forceInitialConfiguration, bool forceExtraConfiguration);
|
void parse(bool forceCMakeRun,
|
||||||
|
bool forceInitialConfiguration,
|
||||||
|
bool forceExtraConfiguration,
|
||||||
|
bool debugging);
|
||||||
void stop();
|
void stop();
|
||||||
void stopCMakeRun();
|
void stopCMakeRun();
|
||||||
|
|
||||||
@@ -64,6 +67,7 @@ signals:
|
|||||||
void dataAvailable(bool restoredFromBackup) const;
|
void dataAvailable(bool restoredFromBackup) const;
|
||||||
void dirty() const;
|
void dirty() const;
|
||||||
void errorOccurred(const QString &message) const;
|
void errorOccurred(const QString &message) const;
|
||||||
|
void debuggingStarted() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startState();
|
void startState();
|
||||||
|
@@ -7,8 +7,11 @@
|
|||||||
#include <debugger/debuggeractions.h>
|
#include <debugger/debuggeractions.h>
|
||||||
#include <debugger/debuggercore.h>
|
#include <debugger/debuggercore.h>
|
||||||
#include <debugger/debuggerdialogs.h>
|
#include <debugger/debuggerdialogs.h>
|
||||||
|
#include <debugger/debuggerinternalconstants.h>
|
||||||
|
#include <debugger/debuggermainwindow.h>
|
||||||
#include <debugger/debuggerplugin.h>
|
#include <debugger/debuggerplugin.h>
|
||||||
#include <debugger/debuggerprotocol.h>
|
#include <debugger/debuggerprotocol.h>
|
||||||
|
#include <debugger/debuggerruncontrol.h>
|
||||||
#include <debugger/debuggertooltipmanager.h>
|
#include <debugger/debuggertooltipmanager.h>
|
||||||
#include <debugger/debuggertr.h>
|
#include <debugger/debuggertr.h>
|
||||||
#include <debugger/moduleshandler.h>
|
#include <debugger/moduleshandler.h>
|
||||||
@@ -20,6 +23,8 @@
|
|||||||
#include <debugger/watchhandler.h>
|
#include <debugger/watchhandler.h>
|
||||||
#include <debugger/watchutils.h>
|
#include <debugger/watchutils.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/process.h>
|
#include <utils/process.h>
|
||||||
@@ -31,6 +36,10 @@
|
|||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/buildsystem.h>
|
||||||
|
#include <projectexplorer/projecttree.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -45,7 +54,7 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
static Q_LOGGING_CATEGORY(dapEngineLog, "qtc.dbg.dapengin", QtWarningMsg)
|
static Q_LOGGING_CATEGORY(dapEngineLog, "qtc.dbg.dapengine", QtWarningMsg)
|
||||||
|
|
||||||
namespace Debugger::Internal {
|
namespace Debugger::Internal {
|
||||||
|
|
||||||
@@ -221,21 +230,47 @@ void DapEngine::setupEngine()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qCDebug(dapEngineLog) << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qCDebug(dapEngineLog) << state());
|
||||||
|
|
||||||
if (qEnvironmentVariableIsSet("QTC_USE_CMAKE_DEBUGGER")) {
|
const auto connectDataGeneratorSignals = [this] {
|
||||||
|
if (!m_dataGenerator)
|
||||||
|
return;
|
||||||
|
|
||||||
|
connect(m_dataGenerator.get(), &IDataProvider::started, this, &DapEngine::handleDapStarted);
|
||||||
|
connect(m_dataGenerator.get(), &IDataProvider::done, this, &DapEngine::handleDapDone);
|
||||||
|
connect(m_dataGenerator.get(),
|
||||||
|
&IDataProvider::readyReadStandardOutput,
|
||||||
|
this,
|
||||||
|
&DapEngine::readDapStandardOutput);
|
||||||
|
connect(m_dataGenerator.get(),
|
||||||
|
&IDataProvider::readyReadStandardError,
|
||||||
|
this,
|
||||||
|
&DapEngine::readDapStandardError);
|
||||||
|
};
|
||||||
|
|
||||||
|
Perspective *currentPerspective = DebuggerMainWindow::instance()->currentPerspective();
|
||||||
|
if (currentPerspective->parentPerspectiveId() == Constants::CMAKE_PERSPECTIVE_ID) {
|
||||||
|
qCDebug(dapEngineLog) << "build system name" << ProjectExplorer::ProjectTree::currentBuildSystem()->name();
|
||||||
|
|
||||||
|
m_nextBreakpointId = 0;
|
||||||
m_dataGenerator = std::make_unique<LocalSocketDataProvider>("/tmp/cmake-dap.sock");
|
m_dataGenerator = std::make_unique<LocalSocketDataProvider>("/tmp/cmake-dap.sock");
|
||||||
|
connectDataGeneratorSignals();
|
||||||
|
|
||||||
|
connect(ProjectExplorer::ProjectTree::currentBuildSystem(),
|
||||||
|
&ProjectExplorer::BuildSystem::debuggingStarted,
|
||||||
|
this,
|
||||||
|
[this] {
|
||||||
|
m_dataGenerator->start();
|
||||||
|
});
|
||||||
|
|
||||||
|
ProjectExplorer::ProjectTree::currentBuildSystem()->requestDebugging();
|
||||||
} else {
|
} else {
|
||||||
const DebuggerRunParameters &rp = runParameters();
|
const DebuggerRunParameters &rp = runParameters();
|
||||||
const CommandLine cmd{rp.debugger.command.executable(), {"-i", "dap"}};
|
const CommandLine cmd{rp.debugger.command.executable(), {"-i", "dap"}};
|
||||||
|
|
||||||
m_dataGenerator = std::make_unique<ProcessDataProvider>(rp, cmd);
|
m_dataGenerator = std::make_unique<ProcessDataProvider>(rp, cmd);
|
||||||
|
connectDataGeneratorSignals();
|
||||||
|
m_dataGenerator->start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_dataGenerator.get(), &IDataProvider::started, this, &DapEngine::handleDapStarted);
|
|
||||||
connect(m_dataGenerator.get(), &IDataProvider::done, this, &DapEngine::handleDapDone);
|
|
||||||
connect(m_dataGenerator.get(), &IDataProvider::readyReadStandardOutput, this, &DapEngine::readDapStandardOutput);
|
|
||||||
connect(m_dataGenerator.get(), &IDataProvider::readyReadStandardError, this, &DapEngine::readDapStandardError);
|
|
||||||
|
|
||||||
m_dataGenerator->start();
|
|
||||||
|
|
||||||
notifyEngineSetupOk();
|
notifyEngineSetupOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,13 +360,13 @@ void DapEngine::dapStackTrace()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DapEngine::dapScopes()
|
void DapEngine::dapScopes(int frameId)
|
||||||
{
|
{
|
||||||
postDirectCommand({
|
postDirectCommand({
|
||||||
{"command", "scopes"},
|
{"command", "scopes"},
|
||||||
{"type", "request"},
|
{"type", "request"},
|
||||||
{"arguments", QJsonObject{
|
{"arguments", QJsonObject{
|
||||||
{"frameId", 0}
|
{"frameId", frameId}
|
||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -791,7 +826,7 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
gotoLocation(Location(file, line));
|
gotoLocation(Location(file, line));
|
||||||
|
|
||||||
refreshStack(stackFrames);
|
refreshStack(stackFrames);
|
||||||
dapScopes();
|
dapScopes(stackFrame.value("id").toInt());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,8 +837,8 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
const QString name = scope.toObject().value("name").toString();
|
const QString name = scope.toObject().value("name").toString();
|
||||||
const int variablesReference = scope.toObject().value("variablesReference").toInt();
|
const int variablesReference = scope.toObject().value("variablesReference").toInt();
|
||||||
qCDebug(dapEngineLog) << "scoped success" << name << variablesReference;
|
qCDebug(dapEngineLog) << "scoped success" << name << variablesReference;
|
||||||
if (name == "Locals")
|
// if (name == "Locals")
|
||||||
dapVariables(variablesReference);
|
// dapVariables(variablesReference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -851,15 +886,6 @@ void DapEngine::handleOutput(const QJsonDocument &data)
|
|||||||
const QJsonObject body = ob.value("body").toObject();
|
const QJsonObject body = ob.value("body").toObject();
|
||||||
|
|
||||||
if (event == "exited") {
|
if (event == "exited") {
|
||||||
postDirectCommand({
|
|
||||||
{"command", "disconnect"},
|
|
||||||
{"type", "request"},
|
|
||||||
{"arguments", QJsonObject{
|
|
||||||
{"restart", false},
|
|
||||||
{"terminateDebuggee", true}
|
|
||||||
}}
|
|
||||||
});
|
|
||||||
|
|
||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
showMessage("exited", LogDebug);
|
showMessage("exited", LogDebug);
|
||||||
return;
|
return;
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <debugger/debuggerengine.h>
|
#include <debugger/debuggerengine.h>
|
||||||
|
|
||||||
#include <utils/process.h>
|
#include <utils/process.h>
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@@ -108,7 +109,7 @@ private:
|
|||||||
void handleDapConfigurationDone();
|
void handleDapConfigurationDone();
|
||||||
|
|
||||||
void dapStackTrace();
|
void dapStackTrace();
|
||||||
void dapScopes();
|
void dapScopes(int frameId);
|
||||||
void threads();
|
void threads();
|
||||||
void dapVariables(int variablesReference);
|
void dapVariables(int variablesReference);
|
||||||
|
|
||||||
|
@@ -541,13 +541,15 @@ void DebuggerEnginePrivate::setupViews()
|
|||||||
|
|
||||||
QTC_CHECK(!m_perspective);
|
QTC_CHECK(!m_perspective);
|
||||||
|
|
||||||
|
Perspective *currentPerspective = DebuggerMainWindow::instance()->currentPerspective();
|
||||||
|
|
||||||
const QString perspectiveId = "Debugger.Perspective." + m_runId + '.' + m_debuggerName;
|
const QString perspectiveId = "Debugger.Perspective." + m_runId + '.' + m_debuggerName;
|
||||||
const QString settingsId = "Debugger.Perspective." + m_debuggerName;
|
const QString settingsId = "Debugger.Perspective." + m_debuggerName;
|
||||||
|
const QString parentPerspectiveId = currentPerspective ? currentPerspective->id()
|
||||||
|
: Constants::PRESET_PERSPECTIVE_ID;
|
||||||
|
|
||||||
m_perspective = new Perspective(perspectiveId,
|
m_perspective
|
||||||
m_engine->displayName(),
|
= new Perspective(perspectiveId, m_engine->displayName(), parentPerspectiveId, settingsId);
|
||||||
Debugger::Constants::PRESET_PERSPECTIVE_ID,
|
|
||||||
settingsId);
|
|
||||||
|
|
||||||
m_progress.setProgressRange(0, 1000);
|
m_progress.setProgressRange(0, 1000);
|
||||||
FutureProgress *fp = ProgressManager::addTask(m_progress.future(),
|
FutureProgress *fp = ProgressManager::addTask(m_progress.future(),
|
||||||
@@ -724,7 +726,8 @@ void DebuggerEnginePrivate::setupViews()
|
|||||||
m_breakWindow->setObjectName("Debugger.Dock.Break." + engineId);
|
m_breakWindow->setObjectName("Debugger.Dock.Break." + engineId);
|
||||||
m_breakWindow->setWindowTitle(Tr::tr("&Breakpoints"));
|
m_breakWindow->setWindowTitle(Tr::tr("&Breakpoints"));
|
||||||
|
|
||||||
m_perspective->useSubPerspectiveSwitcher(EngineManager::engineChooser());
|
if (!currentPerspective || currentPerspective->id() == Constants::PRESET_PERSPECTIVE_ID)
|
||||||
|
m_perspective->useSubPerspectiveSwitcher(EngineManager::engineChooser());
|
||||||
|
|
||||||
m_perspective->addToolBarAction(&m_continueAction);
|
m_perspective->addToolBarAction(&m_continueAction);
|
||||||
m_perspective->addToolBarAction(&m_interruptAction);
|
m_perspective->addToolBarAction(&m_interruptAction);
|
||||||
|
@@ -41,6 +41,7 @@ const char C_QMLDEBUGGER[] = "Qml/JavaScript Debugger";
|
|||||||
const char C_DEBUGGER_NOTRUNNING[] = "Debugger.NotRunning";
|
const char C_DEBUGGER_NOTRUNNING[] = "Debugger.NotRunning";
|
||||||
|
|
||||||
const char PRESET_PERSPECTIVE_ID[] = "Debugger.Perspective.Preset";
|
const char PRESET_PERSPECTIVE_ID[] = "Debugger.Perspective.Preset";
|
||||||
|
const char CMAKE_PERSPECTIVE_ID[] = "Debugger.Perspective.Cmake";
|
||||||
|
|
||||||
const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime";
|
const char TASK_CATEGORY_DEBUGGER_RUNTIME[] = "DebugRuntime";
|
||||||
|
|
||||||
|
@@ -785,6 +785,11 @@ QString Perspective::id() const
|
|||||||
return d->m_id;
|
return d->m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Perspective::parentPerspectiveId() const
|
||||||
|
{
|
||||||
|
return d->m_parentPerspectiveId;
|
||||||
|
}
|
||||||
|
|
||||||
QString Perspective::name() const
|
QString Perspective::name() const
|
||||||
{
|
{
|
||||||
return d->m_name;
|
return d->m_name;
|
||||||
|
@@ -76,6 +76,7 @@ public:
|
|||||||
void setShouldPersistChecker(const ShouldPersistChecker &checker);
|
void setShouldPersistChecker(const ShouldPersistChecker &checker);
|
||||||
|
|
||||||
QString id() const; // Currently used by GammaRay plugin.
|
QString id() const; // Currently used by GammaRay plugin.
|
||||||
|
QString parentPerspectiveId() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QWidget *centralWidget() const;
|
QWidget *centralWidget() const;
|
||||||
|
|
||||||
|
@@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/buildmanager.h>
|
#include <projectexplorer/buildmanager.h>
|
||||||
|
#include <projectexplorer/buildsystem.h>
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
#include <projectexplorer/devicesupport/deviceprocessesdialog.h>
|
||||||
#include <projectexplorer/devicesupport/sshparameters.h>
|
#include <projectexplorer/devicesupport/sshparameters.h>
|
||||||
@@ -660,6 +661,7 @@ public:
|
|||||||
ProxyAction m_hiddenStopAction;
|
ProxyAction m_hiddenStopAction;
|
||||||
QAction m_undisturbableAction;
|
QAction m_undisturbableAction;
|
||||||
OptionalAction m_startAction;
|
OptionalAction m_startAction;
|
||||||
|
OptionalAction m_startCmakeAction;
|
||||||
QAction m_debugWithoutDeployAction{Tr::tr("Start Debugging Without Deployment")};
|
QAction m_debugWithoutDeployAction{Tr::tr("Start Debugging Without Deployment")};
|
||||||
QAction m_startAndDebugApplicationAction{Tr::tr("Start and Debug External Application...")};
|
QAction m_startAndDebugApplicationAction{Tr::tr("Start and Debug External Application...")};
|
||||||
QAction m_attachToRunningApplication{Tr::tr("Attach to Running Application...")};
|
QAction m_attachToRunningApplication{Tr::tr("Attach to Running Application...")};
|
||||||
@@ -692,6 +694,7 @@ public:
|
|||||||
IContext m_debugModeContext;
|
IContext m_debugModeContext;
|
||||||
|
|
||||||
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, Tr::tr("Debugger")};
|
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, Tr::tr("Debugger")};
|
||||||
|
std::unique_ptr<Perspective> m_perspectiveCmake;
|
||||||
|
|
||||||
DebuggerKitAspect debuggerKitAspect;
|
DebuggerKitAspect debuggerKitAspect;
|
||||||
CommonOptionsPage commonOptionsPage;
|
CommonOptionsPage commonOptionsPage;
|
||||||
@@ -838,6 +841,11 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
|
|||||||
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, false);
|
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, [] {
|
connect(&m_debugWithoutDeployAction, &QAction::triggered, this, [] {
|
||||||
ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, true);
|
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(breakpointManagerWindow, Perspective::SplitHorizontal, engineManagerWindow);
|
||||||
m_perspective.addWindow(globalLogWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea);
|
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();
|
setInitialState();
|
||||||
|
|
||||||
connect(ProjectManager::instance(), &ProjectManager::startupProjectChanged,
|
connect(ProjectManager::instance(), &ProjectManager::startupProjectChanged,
|
||||||
|
@@ -1136,6 +1136,7 @@ DebuggerRunWorkerFactory::DebuggerRunWorkerFactory()
|
|||||||
{
|
{
|
||||||
setProduct<DebuggerRunTool>();
|
setProduct<DebuggerRunTool>();
|
||||||
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
|
addSupportedRunMode(ProjectExplorer::Constants::CMAKE_DEBUG_RUN_MODE);
|
||||||
addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||||
addSupportedDeviceType("DockerDeviceType");
|
addSupportedDeviceType("DockerDeviceType");
|
||||||
}
|
}
|
||||||
|
@@ -66,6 +66,7 @@ public:
|
|||||||
|
|
||||||
Utils::Environment activeParseEnvironment() const;
|
Utils::Environment activeParseEnvironment() const;
|
||||||
|
|
||||||
|
virtual void requestDebugging() {}
|
||||||
virtual bool addFiles(Node *context,
|
virtual bool addFiles(Node *context,
|
||||||
const Utils::FilePaths &filePaths,
|
const Utils::FilePaths &filePaths,
|
||||||
Utils::FilePaths *notAdded = nullptr);
|
Utils::FilePaths *notAdded = nullptr);
|
||||||
@@ -153,6 +154,7 @@ signals:
|
|||||||
void parsingFinished(bool success);
|
void parsingFinished(bool success);
|
||||||
void deploymentDataChanged();
|
void deploymentDataChanged();
|
||||||
void testInformationUpdated();
|
void testInformationUpdated();
|
||||||
|
void debuggingStarted();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Helper methods to manage parsing state and signalling
|
// Helper methods to manage parsing state and signalling
|
||||||
|
@@ -2932,10 +2932,15 @@ void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
|
|||||||
dd->m_delayedRunConfiguration = rc;
|
dd->m_delayedRunConfiguration = rc;
|
||||||
dd->m_shouldHaveRunConfiguration = true;
|
dd->m_shouldHaveRunConfiguration = true;
|
||||||
};
|
};
|
||||||
const BuildForRunConfigStatus buildStatus = forceSkipDeploy
|
|
||||||
|
BuildForRunConfigStatus buildStatus = forceSkipDeploy
|
||||||
? BuildManager::isBuilding(rc->project())
|
? BuildManager::isBuilding(rc->project())
|
||||||
? BuildForRunConfigStatus::Building : BuildForRunConfigStatus::NotBuilding
|
? BuildForRunConfigStatus::Building : BuildForRunConfigStatus::NotBuilding
|
||||||
: BuildManager::potentiallyBuildForRunConfig(rc);
|
: BuildManager::potentiallyBuildForRunConfig(rc);
|
||||||
|
|
||||||
|
if (dd->m_runMode != Constants::CMAKE_DEBUG_RUN_MODE)
|
||||||
|
buildStatus = BuildForRunConfigStatus::NotBuilding;
|
||||||
|
|
||||||
switch (buildStatus) {
|
switch (buildStatus) {
|
||||||
case BuildForRunConfigStatus::BuildFailed:
|
case BuildForRunConfigStatus::BuildFailed:
|
||||||
return;
|
return;
|
||||||
|
@@ -178,6 +178,7 @@ const char GENERATOR_ID_PREFIX[] = "PE.Wizard.Generator.";
|
|||||||
const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
|
const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
|
||||||
const char NORMAL_RUN_MODE[]="RunConfiguration.NormalRunMode";
|
const char NORMAL_RUN_MODE[]="RunConfiguration.NormalRunMode";
|
||||||
const char DEBUG_RUN_MODE[]="RunConfiguration.DebugRunMode";
|
const char DEBUG_RUN_MODE[]="RunConfiguration.DebugRunMode";
|
||||||
|
const char CMAKE_DEBUG_RUN_MODE[]="RunConfiguration.CmakeDebugRunMode";
|
||||||
const char QML_PROFILER_RUN_MODE[]="RunConfiguration.QmlProfilerRunMode";
|
const char QML_PROFILER_RUN_MODE[]="RunConfiguration.QmlProfilerRunMode";
|
||||||
const char QML_PROFILER_RUNNER[]="RunConfiguration.QmlProfilerRunner";
|
const char QML_PROFILER_RUNNER[]="RunConfiguration.QmlProfilerRunner";
|
||||||
const char QML_PREVIEW_RUN_MODE[]="RunConfiguration.QmlPreviewRunMode";
|
const char QML_PREVIEW_RUN_MODE[]="RunConfiguration.QmlPreviewRunMode";
|
||||||
|
Reference in New Issue
Block a user