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/deps/core/utility/NonOwnerPointer.h"
8#include "mc/scripting/debugger/IScriptDebugger.h"
9#include "mc/scripting/diagnostics/IDebuggerStatPublisher.h"
10
11// auto generated forward declare list
12// clang-format off
13class DebuggerStat;
19class ServerLevel;
21namespace Core { class Path; }
22namespace ScriptDebuggerMessages { struct DebuggerRequestMessage; }
23namespace Scripting { class ScriptEngine; }
24namespace cereal { class DynamicValue; }
25namespace cereal { struct ReflectionCtx; }
26// clang-format on
27
28class ScriptDebugger : public ::IScriptDebugger, public ::IDebuggerStatPublisher {
29public:
30 // ScriptDebugger inner types declare
31 // clang-format off
32 struct AutoAttachTelem;
33 // clang-format on
34
35 // ScriptDebugger inner types define
36 enum class DebuggerMode : int {
37 Stopped = 0,
38 Connect = 1,
39 Listen = 2,
40 };
41
42 struct AutoAttachTelem {
43 public:
44 // member variables
45 // NOLINTBEGIN
48 // NOLINTEND
49
50 public:
51 // prevent constructor by default
52 AutoAttachTelem& operator=(AutoAttachTelem const&);
53 AutoAttachTelem(AutoAttachTelem const&);
54 AutoAttachTelem();
55 };
56
57public:
58 // member variables
59 // NOLINTBEGIN
79 // NOLINTEND
80
81public:
82 // prevent constructor by default
83 ScriptDebugger& operator=(ScriptDebugger const&);
84 ScriptDebugger(ScriptDebugger const&);
85 ScriptDebugger();
86
87public:
88 // virtual functions
89 // NOLINTBEGIN
90 virtual ~ScriptDebugger() /*override*/ = default;
91
92 virtual ::ScriptDebuggerSettings const& getSettings() const /*override*/;
93
94 virtual bool connect(::std::string const& host, ushort port) /*override*/;
95
96 virtual bool listen(ushort port) /*override*/;
97
98 virtual void stop() /*override*/;
99
100 virtual void startProfiler() /*override*/;
101
102 virtual ::std::vector<::Core::Path> stopProfiler() /*override*/;
103
104 virtual bool isStatPublisherEnabled() const /*override*/;
105
106 virtual void publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat> const& stats) /*override*/;
107 // NOLINTEND
108
109public:
110 // member functions
111 // NOLINTBEGIN
112 MCNAPI ScriptDebugger(
113 ::ScriptDebuggerSettings settings,
114 ::ServerLevel& serverLevel,
115 ::MinecraftCommands& commands,
116 ::cereal::ReflectionCtx& ctx,
117 ::Scripting::ScriptEngine& scriptEngine,
118 ::ScriptPluginManager& pluginManager,
119 ::IScriptDebuggerWatchdog& watchdog,
120 ::IScriptTelemetryLogger& telemetry,
121 ::Bedrock::NonOwnerPointer<::LocalProfilerControlBroker> const& profilerControlBroker
122 );
123
124 MCNAPI void _debuggerMessageHandler(::std::string_view message);
125
126 MCNAPI void
127 _handleDebuggerRequestMessage(::ScriptDebuggerMessages::DebuggerRequestMessage const& debuggerRequestPayload);
128
129 MCNAPI ::std::string _sanitizeHostName(::std::string const& host) const;
130
131 MCNAPI void _sendNotification(::LogLevel logLevel, ::std::string_view message);
132
133 MCNAPI bool _tryAttachRuntime(bool expectRuntime);
134
135 MCNAPI bool _trySelectTarget();
136
138 ::std::string_view command,
139 ::std::function<void(::ScriptDebuggerMessages::DebuggerRequestMessage const&, ::ScriptDebugger&)> handler
140 );
141
143 int requestSeq,
144 bool success,
145 ::std::string_view responseMessage,
146 ::std::optional<::cereal::DynamicValue> args
147 );
148
149 MCNAPI void sendLog(::LogLevel logLevel, ::std::string_view message);
150
151 MCNAPI void sendViews();
152
153 MCNAPI void update();
154
155 MCNAPI void waitAutoAttach(::std::chrono::seconds waitDuration);
156 // NOLINTEND
157
158public:
159 // constructor thunks
160 // NOLINTBEGIN
161 MCNAPI void* $ctor(
162 ::ScriptDebuggerSettings settings,
163 ::ServerLevel& serverLevel,
164 ::MinecraftCommands& commands,
165 ::cereal::ReflectionCtx& ctx,
166 ::Scripting::ScriptEngine& scriptEngine,
167 ::ScriptPluginManager& pluginManager,
168 ::IScriptDebuggerWatchdog& watchdog,
169 ::IScriptTelemetryLogger& telemetry,
170 ::Bedrock::NonOwnerPointer<::LocalProfilerControlBroker> const& profilerControlBroker
171 );
172 // NOLINTEND
173
174public:
175 // virtual function thunks
176 // NOLINTBEGIN
177 MCNAPI ::ScriptDebuggerSettings const& $getSettings() const;
178
179 MCNAPI bool $connect(::std::string const& host, ushort port);
180
181 MCNAPI bool $listen(ushort port);
182
183 MCNAPI void $stop();
184
185 MCNAPI void $startProfiler();
186
187 MCNAPI ::std::vector<::Core::Path> $stopProfiler();
188
189 MCNAPI bool $isStatPublisherEnabled() const;
190
191 MCNAPI void $publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat> const& stats);
192
193
194 // NOLINTEND
195};
Definition Path.h:11
Definition DebuggerStat.h:10
Definition IDebuggerStatPublisher.h:10
Definition IScriptDebuggerWatchdog.h:5
Definition IScriptDebugger.h:11
Definition IScriptTelemetryLogger.h:10
Definition LocalProfilerControlBroker.h:11
Definition MinecraftCommands.h:33
Definition Path.h:16
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)
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 void update()
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 sendLog(::LogLevel logLevel, ::std::string_view message)
MCAPI void sendViews()
MCAPI void waitAutoAttach(::std::chrono::seconds waitDuration)
MCAPI bool _tryAttachRuntime(bool expectRuntime)
MCAPI void $publishStats(uint64 collectedTick, ::std::vector<::DebuggerStat > const &stats)
MCAPI void * $ctor(::ScriptDebuggerSettings settings, ::ServerLevel &serverLevel, ::MinecraftCommands &commands, ::cereal::ReflectionCtx &ctx, ::Scripting::ScriptEngine &scriptEngine, ::ScriptPluginManager &pluginManager, ::IScriptDebuggerWatchdog &watchdog, ::IScriptTelemetryLogger &telemetry, ::Bedrock::NonOwnerPointer<::LocalProfilerControlBroker > const &profilerControlBroker)
MCAPI void _handleDebuggerRequestMessage(::ScriptDebuggerMessages::DebuggerRequestMessage const &debuggerRequestPayload)
Definition ScriptPluginManager.h:33
Definition ScriptEngine.h:21
Definition ServerLevel.h:57
Definition DynamicValue.h:14
STL namespace.
Definition DebuggerRequestMessage.h:11
Definition ScriptDebuggerSettings.h:8
Definition ScriptDebugger.h:42
Definition ReflectionCtx.h:11
Definition ctx.h:5
Definition Alias.h:14