MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / initialize

Method initialize

core/debugger/engine_debugger.cpp:131–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bool p_ignore_error_breaks, const Vector<String> &p_breakpoints, void (*p_allow_focus_steal_fn)()) {
132 register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create); // TCP is the default protocol. Platforms/modules can add more.
133 if (p_uri.is_empty()) {
134 return;
135 }
136 if (p_uri == "local://") {
137 singleton = memnew(LocalDebugger);
138 script_debugger = memnew(ScriptDebugger);
139 // Tell the OS that we want to handle termination signals.
140 OS::get_singleton()->initialize_debugging();
141 } else if (p_uri.contains("://")) {
142 const String proto = p_uri.substr(0, p_uri.find("://") + 3);
143 if (!protocols.has(proto)) {
144 return;
145 }
146 RemoteDebuggerPeer *peer = protocols[proto](p_uri);
147 if (!peer) {
148 return;
149 }
150 singleton = memnew(RemoteDebugger(Ref<RemoteDebuggerPeer>(peer)));
151 script_debugger = memnew(ScriptDebugger);
152 // Notify editor of our pid (to allow focus stealing).
153 Array msg = { OS::get_singleton()->get_process_id() };
154 singleton->send_message("set_pid", msg);
155 }
156 if (!singleton) {
157 return;
158 }
159
160 // There is a debugger, parse breakpoints.
161 ScriptDebugger *singleton_script_debugger = singleton->get_script_debugger();
162 singleton_script_debugger->set_skip_breakpoints(p_skip_breakpoints);
163 singleton_script_debugger->set_ignore_error_breaks(p_ignore_error_breaks);
164
165 for (int i = 0; i < p_breakpoints.size(); i++) {
166 const String &bp = p_breakpoints[i];
167 int sp = bp.rfind_char(':');
168 ERR_CONTINUE_MSG(sp == -1, vformat("Invalid breakpoint: '%s', expected file:line format.", bp));
169
170 singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1).to_int(), bp.substr(0, sp));
171 }
172
173 allow_focus_steal_fn = p_allow_focus_steal_fn;
174}
175
176void EngineDebugger::deinitialize() {
177 if (singleton) {

Callers

nothing calls this directly

Calls 15

RemoteDebuggerClass · 0.85
vformatFunction · 0.85
substrMethod · 0.80
get_script_debuggerMethod · 0.80
set_skip_breakpointsMethod · 0.80
rfind_charMethod · 0.80
to_intMethod · 0.80
sizeMethod · 0.65
is_emptyMethod · 0.45
initialize_debuggingMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected