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

@@ -17,6 +17,31 @@ class GdbMi;
* A debugger engine for the debugger adapter protocol.
*/
class IDataProvider : public QObject
{
Q_OBJECT
public:
virtual void start() = 0;
virtual bool isRunning() const = 0;
virtual void writeRaw(const QByteArray &input) = 0;
virtual void kill() = 0;
virtual QByteArray readAllStandardOutput() = 0;
virtual QString readAllStandardError() = 0;
virtual int exitCode() const = 0;
virtual QString executable() const = 0;
virtual QProcess::ExitStatus exitStatus() const = 0;
virtual QProcess::ProcessError error() const = 0;
virtual Utils::ProcessResult result() const = 0;
virtual QString exitMessage() const = 0;
signals:
void started();
void done();
void readyReadStandardOutput();
void readyReadStandardError();
};
class DapEngine : public DebuggerEngine
{
public:
@@ -96,7 +121,8 @@ private:
void updateLocals() override;
QByteArray m_inbuffer;
Utils::Process m_proc;
std::unique_ptr<IDataProvider> m_dataGenerator = nullptr;
int m_nextBreakpointId = 1;
int m_currentThreadId = -1;
};