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