DAP: Add CMake support to DAP engine

Added CMake support to the DAP engine in Qt Creator.
This feature can be enabled by setting the environment
variable QTC_USE_CMAKE_DEBUGGER. CMake debug session can
be started by clicking "Run CMake" or "Run".

Note:
Doesn't work with "Run debugging" in this patch.
Works only with cmake 3.27.0 and newer.

Change-Id: I756ea57f507aa4a6621ad62a8c0ef52c44a5185d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Artem Sokolovskii
2023-06-27 16:57:51 +02:00
parent 52bc1578e5
commit 1fc0ca5277
8 changed files with 272 additions and 69 deletions

View File

@@ -1693,12 +1693,27 @@ RunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
debugger->setStartMode(AttachToLocalProcess);
debugger->setCloseMode(DetachAtClose);
debugger->setContinueAfterAttach(contAfterAttach);
debugger->setCmakeDapDebugging(processInfo.executable.endsWith(QLatin1String("cmake")));
debugger->startRunControl();
return debugger->runControl();
}
void DebuggerPlugin::attachToProcess(const qint64 processId, const Utils::FilePath &executable)
{
ProcessInfo processInfo;
processInfo.processId = processId;
processInfo.executable = executable.toString();
auto kitChooser = new KitChooser;
kitChooser->setShowIcons(true);
kitChooser->populate();
Kit *kit = kitChooser->currentKit();
dd->attachToRunningProcess(kit, processInfo, false);
}
void DebuggerPlugin::attachExternalApplication(RunControl *rc)
{
ProcessHandle pid = rc->applicationProcessHandle();