cmDebuggerThread.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <cstddef>
  6. #include <cstdint>
  7. #include <memory>
  8. #include <mutex>
  9. #include <string>
  10. #include <unordered_map>
  11. #include <vector>
  12. #include <cm3p/cppdap/protocol.h>
  13. class cmListFileFunction;
  14. class cmMakefile;
  15. namespace cmDebugger {
  16. class cmDebuggerStackFrame;
  17. class cmDebuggerVariables;
  18. class cmDebuggerVariablesManager;
  19. }
  20. namespace cmDebugger {
  21. class cmDebuggerThread
  22. {
  23. int64_t Id;
  24. std::string Name;
  25. std::vector<std::shared_ptr<cmDebuggerStackFrame>> Frames;
  26. std::unordered_map<int64_t, std::shared_ptr<cmDebuggerStackFrame>> FrameMap;
  27. std::mutex Mutex;
  28. std::unordered_map<int64_t, std::vector<dap::Scope>> FrameScopes;
  29. std::unordered_map<int64_t,
  30. std::vector<std::shared_ptr<cmDebuggerVariables>>>
  31. FrameVariables;
  32. std::shared_ptr<cmDebuggerVariablesManager> VariablesManager;
  33. public:
  34. cmDebuggerThread(int64_t id, std::string name);
  35. int64_t GetId() const { return this->Id; }
  36. const std::string& GetName() const { return this->Name; }
  37. void PushStackFrame(cmMakefile* mf, std::string const& sourcePath,
  38. cmListFileFunction const& lff);
  39. void PopStackFrame();
  40. std::shared_ptr<cmDebuggerStackFrame> GetTopStackFrame();
  41. std::shared_ptr<cmDebuggerStackFrame> GetStackFrame(int64_t frameId);
  42. size_t GetStackFrameSize() const { return this->Frames.size(); }
  43. dap::ScopesResponse GetScopesResponse(int64_t frameId,
  44. bool supportsVariableType);
  45. dap::VariablesResponse GetVariablesResponse(
  46. dap::VariablesRequest const& request);
  47. friend dap::StackTraceResponse GetStackTraceResponse(
  48. std::shared_ptr<cmDebuggerThread> const& thread);
  49. };
  50. } // namespace cmDebugger