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:
Artem Sokolovskii
2023-07-04 16:32:37 +02:00
parent a5e773aeee
commit cd6e990de8
17 changed files with 140 additions and 49 deletions

View File

@@ -122,8 +122,9 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
m_process->setWorkingDirectory(buildDirectory);
m_process->setEnvironment(parameters.environment);
m_process->setStdOutLineCallback([](const QString &s) {
m_process->setStdOutLineCallback([this](const QString &s) {
BuildSystem::appendBuildSystemOutput(stripTrailingNewline(s));
emit stdOutReady(s);
});
m_process->setStdErrLineCallback([this](const QString &s) {
@@ -139,19 +140,6 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
commandLine.addArgs({"-S", sourceDirectory.path(), "-B", buildDirectory.path()});
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);
BuildSystem::startNewBuildSystemOutput(::CMakeProjectManager::Tr::tr("Running %1 in %2.")