Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
ScriptDebugger.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/debug/log/LogLevel.h"
7#include "mc/scripting/debugger/IScriptDebugger.h"
8#include "mc/scripting/diagnostics/IDebuggerStatPublisher.h"
9
10// auto generated forward declare list
11// clang-format off
12class DebuggerStat;
14namespace Core { class Path; }
15namespace ScriptDebuggerMessages { struct CommandMessage; }
16namespace ScriptDebuggerMessages { struct DebuggerRequestMessage; }
17namespace ScriptDebuggerMessages { struct DiagnosticsSetActiveMessage; }
18namespace ScriptDebuggerMessages { struct StartProfilerMessage; }
19namespace ScriptDebuggerMessages { struct StopProfilerMessage; }
20namespace cereal { class DynamicValue; }
21// clang-format on
22
23class ScriptDebugger : public ::IScriptDebugger, public ::IDebuggerStatPublisher {
24public:
25 // ScriptDebugger inner types declare
26 // clang-format off
27 struct AutoAttachTelem;
28 // clang-format on
29
30 // ScriptDebugger inner types define
31 enum class DebuggerMode : int {
32 Stopped = 0,
33 Connect = 1,
34 Listen = 2,
35 };
36
37 struct AutoAttachTelem {
38 public:
39 // member variables
40 // NOLINTBEGIN
43 // NOLINTEND
44
45 public:
46 // prevent constructor by default
47 AutoAttachTelem& operator=(AutoAttachTelem const&);
48 AutoAttachTelem(AutoAttachTelem const&);
49 AutoAttachTelem();
50 };
51
52public:
53 // member variables
54 // NOLINTBEGIN
74 // NOLINTEND
75
76public:
77 // prevent constructor by default
78 ScriptDebugger& operator=(ScriptDebugger const&);
79 ScriptDebugger(ScriptDebugger const&);
80 ScriptDebugger();
81
82public:
83 // virtual functions
84 // NOLINTBEGIN
85 virtual ~ScriptDebugger() /*override*/ = default;
86
87 virtual ::ScriptDebuggerSettings const& getSettings() const /*override*/;
88
89 virtual bool connect(::std::string const& host, ushort port) /*override*/;
90
91 virtual bool listen(ushort port) /*override*/;
92
93 virtual void stop() /*override*/;
94
95 virtual void startProfiler() /*override*/;
96
97 virtual ::std::vector<::Core::Path> stopProfiler() /*override*/;
98
99 virtual bool isStatPublisherEnabled() const /*override*/;
100
101 virtual void publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat> const& stats) /*override*/;
102 // NOLINTEND
103
104public:
105 // member functions
106 // NOLINTBEGIN
107 MCNAPI void _debuggerMessageHandler(::std::string_view message);
108
109 MCNAPI void _handleCommandMessage(::ScriptDebuggerMessages::CommandMessage const& commandMessage);
110
111 MCNAPI void
112 _handleDebuggerRequestMessage(::ScriptDebuggerMessages::DebuggerRequestMessage const& debuggerRequestPayload);
113
114 MCNAPI void _handleStartProfilerMessage(::ScriptDebuggerMessages::StartProfilerMessage const& profilerMessage);
115
116 MCNAPI void _handleStopProfilerMessage(::ScriptDebuggerMessages::StopProfilerMessage const& profilerMessage);
117
118 MCNAPI ::std::string _sanitizeHostName(::std::string const& host) const;
119
120 MCNAPI void _sendNotification(::LogLevel logLevel, ::std::string_view message);
121
122 MCNAPI bool _tryAttachRuntime(bool expectRuntime);
123
124 MCNAPI bool _trySelectTarget();
125
127 ::std::string_view command,
128 ::std::function<void(::ScriptDebuggerMessages::DebuggerRequestMessage const&, ::ScriptDebugger&)> handler
129 );
130
132 int requestSeq,
133 bool success,
134 ::std::string_view responseMessage,
135 ::std::optional<::cereal::DynamicValue> args
136 );
137
138 MCNAPI void sendLog(::LogLevel logLevel, ::std::string_view message);
139
140 MCNAPI void sendViews();
141 // NOLINTEND
142
143public:
144 // static functions
145 // NOLINTBEGIN
146 MCNAPI static void
147 _handleDiagnosticsSetActiveMessage(::ScriptDebuggerMessages::DiagnosticsSetActiveMessage const& payload);
148 // NOLINTEND
149
150public:
151 // virtual function thunks
152 // NOLINTBEGIN
153 MCNAPI ::ScriptDebuggerSettings const& $getSettings() const;
154
155 MCNAPI bool $connect(::std::string const& host, ushort port);
156
157 MCNAPI bool $listen(ushort port);
158
159 MCNAPI void $stop();
160
161 MCNAPI void $startProfiler();
162
163 MCNAPI ::std::vector<::Core::Path> $stopProfiler();
164
165 MCNAPI bool $isStatPublisherEnabled() const;
166
167 MCNAPI void $publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat> const& stats);
168
169
170 // NOLINTEND
171};
Definition CommandMessage.h:16
Definition Path.h:10
Definition DebuggerStat.h:10
Definition IDebuggerStatPublisher.h:10
Definition IScriptDebugger.h:11
Definition Path.h:16
MCAPI void _handleCommandMessage(::ScriptDebuggerMessages::CommandMessage const &commandMessage)
MCAPI::ScriptDebuggerSettings const & $getSettings() const
MCAPI void _sendNotification(::LogLevel logLevel, ::std::string_view message)
MCAPI bool $listen(ushort port)
MCAPI bool $connect(::std::string const &host, ushort port)
static MCAPI void _handleDiagnosticsSetActiveMessage(::ScriptDebuggerMessages::DiagnosticsSetActiveMessage const &payload)
MCAPI::std::string _sanitizeHostName(::std::string const &host) const
MCAPI void sendDebuggeeResponse(int requestSeq, bool success, ::std::string_view responseMessage, ::std::optional<::cereal::DynamicValue > args)
MCAPI bool $isStatPublisherEnabled() const
MCAPI void $startProfiler()
MCAPI bool _trySelectTarget()
MCAPI void _debuggerMessageHandler(::std::string_view message)
MCAPI void registerDebuggerRequestHandler(::std::string_view command, ::std::function< void(::ScriptDebuggerMessages::DebuggerRequestMessage const &, ::ScriptDebugger &)> handler)
MCAPI ::std::vector<::Core::Path > $stopProfiler()
MCAPI void $stop()
MCAPI void _handleStopProfilerMessage(::ScriptDebuggerMessages::StopProfilerMessage const &profilerMessage)
MCAPI void sendLog(::LogLevel logLevel, ::std::string_view message)
MCAPI void sendViews()
MCAPI void _handleStartProfilerMessage(::ScriptDebuggerMessages::StartProfilerMessage const &profilerMessage)
MCAPI bool _tryAttachRuntime(bool expectRuntime)
MCAPI void $publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat > const &stats)
MCAPI void _handleDebuggerRequestMessage(::ScriptDebuggerMessages::DebuggerRequestMessage const &debuggerRequestPayload)
Definition DynamicValue.h:14
STL namespace.
Definition CommandMessage.h:15
Definition DebuggerRequestMessage.h:16
Definition DiagnosticsSetActiveMessage.h:16
Definition StartProfilerMessage.h:16
Definition StopProfilerMessage.h:16
Definition ScriptDebuggerSettings.h:8
Definition ScriptDebugger.h:37
Definition Alias.h:14