/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once #include "cmConfigure.h" // IWYU pragma: keep #include #include #include #include #include #include #include #include #include // IWYU pragma: keep #include "cmMessageType.h" class cmListFileFunction; class cmMakefile; namespace cmDebugger { class Semaphore; class SyncEvent; class cmDebuggerBreakpointManager; class cmDebuggerExceptionManager; class cmDebuggerThread; class cmDebuggerThreadManager; } namespace dap { class Session; } namespace cmDebugger { class cmDebuggerConnection { public: virtual ~cmDebuggerConnection() = default; virtual bool StartListening(std::string& errorMessage) = 0; virtual void WaitForConnection() = 0; virtual std::shared_ptr GetReader() = 0; virtual std::shared_ptr GetWriter() = 0; }; class cmDebuggerAdapter { public: cmDebuggerAdapter(std::shared_ptr connection, std::string const& dapLogPath); cmDebuggerAdapter(std::shared_ptr connection, cm::optional> logger); ~cmDebuggerAdapter(); void ReportExitCode(int exitCode); void OnFileParsedSuccessfully( std::string const& sourcePath, std::vector const& functions); void OnBeginFunctionCall(cmMakefile* mf, std::string const& sourcePath, cmListFileFunction const& lff); void OnEndFunctionCall(); void OnBeginFileParse(cmMakefile* mf, std::string const& sourcePath); void OnEndFileParse(); void OnMessageOutput(MessageType t, std::string const& text); private: void ClearStepRequests(); std::shared_ptr Connection; std::unique_ptr Session; std::shared_ptr SessionLog; std::thread SessionThread; std::atomic SessionActive; std::mutex Mutex; std::unique_ptr DisconnectEvent; std::unique_ptr ConfigurationDoneEvent; std::unique_ptr ContinueSem; std::atomic NextStepFrom; std::atomic StepInRequest; std::atomic StepOutDepth; std::atomic PauseRequest; std::unique_ptr ThreadManager; std::shared_ptr DefaultThread; std::unique_ptr BreakpointManager; std::unique_ptr ExceptionManager; bool SupportsVariableType; }; } // namespace cmDebugger