summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-02-27 03:30:20 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-03-08 12:36:39 +0100
commitb8ddaf9c33107e01928e04ed462aa08d4017247b (patch)
tree6ab71cdcbfd372e8390baa6ac30a2974fe43d119 /modules
parentd0009636df6544dd26ab7c568a0244af6a20634a (diff)
Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp2
-rw-r--r--modules/gdscript/gdscript.cpp12
-rw-r--r--modules/gdscript/gdscript.h14
-rw-r--r--modules/gdscript/gdscript_compiler.cpp4
-rw-r--r--modules/gdscript/gdscript_editor.cpp8
-rw-r--r--modules/gdscript/gdscript_function.cpp22
-rw-r--r--modules/mono/csharp_script.cpp12
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp5
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp7
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp6
-rw-r--r--modules/visual_script/visual_script.cpp30
-rw-r--r--modules/visual_script/visual_script.h14
12 files changed, 74 insertions, 62 deletions
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index fe1f63f6da..b7cbedc51a 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -194,7 +194,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
if (!ClassDB::is_parent_class(p_this->get_class_name(), base_type)) {
String msg = "Script inherits from native type '" + String(base_type) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'";
// TODO: implement PluginscriptLanguage::debug_break_parse
- // if (ScriptDebugger::get_singleton()) {
+ // if (EngineDebugger::is_active()) {
// _language->debug_break_parse(get_path(), 0, msg);
// }
ERR_FAIL_V_MSG(NULL, msg);
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index c641ce37c5..d31823d632 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -315,7 +315,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
if (top->native.is_valid()) {
if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) {
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
}
ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
@@ -556,7 +556,7 @@ Error GDScript::reload(bool p_keep_state) {
GDScriptParser parser;
Error err = parser.parse(source, basedir, false, path);
if (err) {
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), parser.get_error_line(), "Parser Error: " + parser.get_error());
}
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_error_line(), ("Parse Error: " + parser.get_error()).utf8().get_data(), ERR_HANDLER_SCRIPT);
@@ -571,7 +571,7 @@ Error GDScript::reload(bool p_keep_state) {
if (err) {
if (can_run) {
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), compiler.get_error_line(), "Parser Error: " + compiler.get_error());
}
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), compiler.get_error_line(), ("Compile Error: " + compiler.get_error()).utf8().get_data(), ERR_HANDLER_SCRIPT);
@@ -583,9 +583,9 @@ Error GDScript::reload(bool p_keep_state) {
#ifdef DEBUG_ENABLED
for (const List<GDScriptWarning>::Element *E = parser.get_warnings().front(); E; E = E->next()) {
const GDScriptWarning &warning = E->get();
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
Vector<ScriptLanguage::StackInfo> si;
- ScriptDebugger::get_singleton()->send_error("", get_path(), warning.line, warning.get_name(), warning.get_message(), ERR_HANDLER_WARNING, si);
+ EngineDebugger::get_script_debugger()->send_error("", get_path(), warning.line, warning.get_name(), warning.get_message(), ERR_HANDLER_WARNING, si);
}
}
#endif
@@ -2201,7 +2201,7 @@ GDScriptLanguage::GDScriptLanguage() {
int dmcs = GLOBAL_DEF("debug/settings/gdscript/max_call_stack", 1024);
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/gdscript/max_call_stack", PropertyInfo(Variant::INT, "debug/settings/gdscript/max_call_stack", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); //minimum is 1024
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
//debugging enabled!
_debug_max_call_stack = dmcs;
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 3a90f0fc20..456cd88fe6 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -31,6 +31,8 @@
#ifndef GDSCRIPT_H
#define GDSCRIPT_H
+#include "core/debugger/engine_debugger.h"
+#include "core/debugger/script_debugger.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/script_language.h"
@@ -393,13 +395,13 @@ public:
if (Thread::get_main_id() != Thread::get_caller_id())
return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
- ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() + 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() + 1);
if (_debug_call_stack_pos >= _debug_max_call_stack) {
//stack overflow
_debug_error = "Stack Overflow (Stack Size: " + itos(_debug_max_call_stack) + ")";
- ScriptDebugger::get_singleton()->debug(this);
+ EngineDebugger::get_script_debugger()->debug(this);
return;
}
@@ -416,13 +418,13 @@ public:
if (Thread::get_main_id() != Thread::get_caller_id())
return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
- ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() - 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() - 1);
if (_debug_call_stack_pos == 0) {
_debug_error = "Stack Underflow (Engine Bug)";
- ScriptDebugger::get_singleton()->debug(this);
+ EngineDebugger::get_script_debugger()->debug(this);
return;
}
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 4bd425f999..42efdeffbb 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -1579,7 +1579,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
codegen.stack_max = 0;
codegen.current_line = 0;
codegen.call_max = 0;
- codegen.debug_stack = ScriptDebugger::get_singleton() != NULL;
+ codegen.debug_stack = EngineDebugger::is_active();
Vector<StringName> argnames;
int stack_level = 0;
@@ -1765,7 +1765,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_call_size = codegen.call_max;
gdfunc->name = func_name;
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
String signature;
//path
if (p_script->get_path() != String())
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 1bc1aae0d2..966a3db840 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -221,12 +221,12 @@ Script *GDScriptLanguage::create_script() const {
bool GDScriptLanguage::debug_break_parse(const String &p_file, int p_line, const String &p_error) {
//break because of parse error
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_line = p_line;
_debug_parse_err_file = p_file;
_debug_error = p_error;
- ScriptDebugger::get_singleton()->debug(this, false, true);
+ EngineDebugger::get_script_debugger()->debug(this, false, true);
return true;
} else {
return false;
@@ -235,13 +235,13 @@ bool GDScriptLanguage::debug_break_parse(const String &p_file, int p_line, const
bool GDScriptLanguage::debug_break(const String &p_error, bool p_allow_continue) {
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_line = -1;
_debug_parse_err_file = "";
_debug_error = p_error;
bool is_error_breakpoint = p_error != "Breakpoint";
- ScriptDebugger::get_singleton()->debug(this, p_allow_continue, is_error_breakpoint);
+ EngineDebugger::get_script_debugger()->debug(this, p_allow_continue, is_error_breakpoint);
return true;
} else {
return false;
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 79c550c81c..3f73654a1e 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -391,7 +391,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton())
+ if (EngineDebugger::is_active())
GDScriptLanguage::get_singleton()->enter_function(p_instance, this, stack, &ip, &line);
#define GD_ERR_BREAK(m_cond) \
@@ -1522,7 +1522,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE(OPCODE_BREAKPOINT) {
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break("Breakpoint Statement", true);
}
#endif
@@ -1536,26 +1536,26 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
line = _code_ptr[ip + 1];
ip += 2;
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
// line
bool do_break = false;
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0) {
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0) {
- if (ScriptDebugger::get_singleton()->get_depth() <= 0)
- ScriptDebugger::get_singleton()->set_lines_left(ScriptDebugger::get_singleton()->get_lines_left() - 1);
- if (ScriptDebugger::get_singleton()->get_lines_left() <= 0)
+ if (EngineDebugger::get_script_debugger()->get_depth() <= 0)
+ EngineDebugger::get_script_debugger()->set_lines_left(EngineDebugger::get_script_debugger()->get_lines_left() - 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() <= 0)
do_break = true;
}
- if (ScriptDebugger::get_singleton()->is_breakpoint(line, source))
+ if (EngineDebugger::get_script_debugger()->is_breakpoint(line, source))
do_break = true;
if (do_break) {
GDScriptLanguage::get_singleton()->debug_break("Breakpoint", true);
}
- ScriptDebugger::get_singleton()->line_poll();
+ EngineDebugger::get_singleton()->line_poll();
}
}
DISPATCH_OPCODE;
@@ -1622,7 +1622,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
// When it's the last resume it will postpone the exit from stack,
// so the debugger knows which function triggered the resume of the next function (if any)
if (!p_state || yielded) {
- if (ScriptDebugger::get_singleton())
+ if (EngineDebugger::is_active())
GDScriptLanguage::get_singleton()->exit_function();
#endif
@@ -1884,7 +1884,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
}
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton())
+ if (EngineDebugger::is_active())
GDScriptLanguage::get_singleton()->exit_function();
if (state.stack_size) {
//free stack
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 6809cbdff9..02ff6bcf13 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -33,6 +33,8 @@
#include <mono/metadata/threads.h>
#include <stdint.h>
+#include "core/debugger/engine_debugger.h"
+#include "core/debugger/script_debugger.h"
#include "core/io/json.h"
#include "core/os/file_access.h"
#include "core/os/mutex.h"
@@ -1134,11 +1136,11 @@ void CSharpLanguage::thread_exit() {
bool CSharpLanguage::debug_break_parse(const String &p_file, int p_line, const String &p_error) {
// Not a parser error in our case, but it's still used for other type of errors
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_line = p_line;
_debug_parse_err_file = p_file;
_debug_error = p_error;
- ScriptDebugger::get_singleton()->debug(this, false, true);
+ EngineDebugger::get_script_debugger()->debug(this, false, true);
return true;
} else {
return false;
@@ -1147,11 +1149,11 @@ bool CSharpLanguage::debug_break_parse(const String &p_file, int p_line, const S
bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_line = -1;
_debug_parse_err_file = "";
_debug_error = p_error;
- ScriptDebugger::get_singleton()->debug(this, p_allow_continue);
+ EngineDebugger::get_script_debugger()->debug(this, p_allow_continue);
return true;
} else {
return false;
@@ -2998,7 +3000,7 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
if (native) {
String native_name = NATIVE_GDMONOCLASS_NAME(native);
if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
CSharpLanguage::get_singleton()->debug_break_parse(get_path(), 0, "Script inherits from native type '" + native_name + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
}
ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + native_name +
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 895393537f..eb4c263745 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -37,6 +37,7 @@
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/profiler.h>
+#include "core/debugger/engine_debugger.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/os/os.h"
@@ -1183,8 +1184,8 @@ void GDMono::unhandled_exception_hook(MonoObject *p_exc, void *) {
#ifdef DEBUG_ENABLED
GDMonoUtils::debug_send_unhandled_exception_error((MonoException *)p_exc);
- if (ScriptDebugger::get_singleton())
- ScriptDebugger::get_singleton()->idle_poll();
+ if (EngineDebugger::is_active())
+ EngineDebugger::get_singleton()->poll_events(false);
#endif
exit(mono_environment_exitcode_get());
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index 74ffa90cb3..b179b484f3 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -38,6 +38,9 @@
#include "gd_mono_marshal.h"
#include "gd_mono_utils.h"
+#include "core/debugger/engine_debugger.h"
+#include "core/debugger/script_debugger.h"
+
#include <mono/metadata/exception.h>
namespace GDMonoInternals {
@@ -120,8 +123,8 @@ void unhandled_exception(MonoException *p_exc) {
} else {
#ifdef DEBUG_ENABLED
GDMonoUtils::debug_send_unhandled_exception_error((MonoException *)p_exc);
- if (ScriptDebugger::get_singleton())
- ScriptDebugger::get_singleton()->idle_poll();
+ if (EngineDebugger::is_active())
+ EngineDebugger::get_singleton()->poll_events(false);
#endif
}
}
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index b3a573bcd4..bc290f3a7f 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -32,6 +32,8 @@
#include <mono/metadata/exception.h>
+#include "core/debugger/engine_debugger.h"
+#include "core/debugger/script_debugger.h"
#include "core/os/dir_access.h"
#include "core/os/mutex.h"
#include "core/os/os.h"
@@ -351,7 +353,7 @@ void debug_print_unhandled_exception(MonoException *p_exc) {
void debug_send_unhandled_exception_error(MonoException *p_exc) {
#ifdef DEBUG_ENABLED
- if (!ScriptDebugger::get_singleton()) {
+ if (!EngineDebugger::is_active()) {
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
ERR_PRINT(GDMonoUtils::get_exception_name_and_message(p_exc));
@@ -410,7 +412,7 @@ void debug_send_unhandled_exception_error(MonoException *p_exc) {
int line = si.size() ? si[0].line : __LINE__;
String error_msg = "Unhandled exception";
- ScriptDebugger::get_singleton()->send_error(func, file, line, error_msg, exc_msg, ERR_HANDLER_ERROR, si);
+ EngineDebugger::get_script_debugger()->send_error(func, file, line, error_msg, exc_msg, ERR_HANDLER_ERROR, si);
#endif
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 471f43cadd..050fdbcb07 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1629,7 +1629,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
int flow_stack_pos = p_flow_stack_pos;
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
VisualScriptLanguage::singleton->enter_function(this, &p_method, variant_stack, &working_mem, &current_node_id);
}
#endif
@@ -1766,7 +1766,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
#ifdef DEBUG_ENABLED
//will re-enter later, so exiting
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
VisualScriptLanguage::singleton->exit_function();
}
#endif
@@ -1776,26 +1776,26 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
}
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
// line
bool do_break = false;
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0) {
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0) {
- if (ScriptDebugger::get_singleton()->get_depth() <= 0)
- ScriptDebugger::get_singleton()->set_lines_left(ScriptDebugger::get_singleton()->get_lines_left() - 1);
- if (ScriptDebugger::get_singleton()->get_lines_left() <= 0)
+ if (EngineDebugger::get_script_debugger()->get_depth() <= 0)
+ EngineDebugger::get_script_debugger()->set_lines_left(EngineDebugger::get_script_debugger()->get_lines_left() - 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() <= 0)
do_break = true;
}
- if (ScriptDebugger::get_singleton()->is_breakpoint(current_node_id, source))
+ if (EngineDebugger::get_script_debugger()->is_breakpoint(current_node_id, source))
do_break = true;
if (do_break) {
VisualScriptLanguage::singleton->debug_break("Breakpoint", true);
}
- ScriptDebugger::get_singleton()->line_poll();
+ EngineDebugger::get_singleton()->line_poll();
}
#endif
int output = ret & VisualScriptNodeInstance::STEP_MASK;
@@ -1983,7 +1983,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
}
#ifdef DEBUG_ENABLED
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
VisualScriptLanguage::singleton->exit_function();
}
#endif
@@ -2593,12 +2593,12 @@ void VisualScriptLanguage::add_global_constant(const StringName &p_variable, con
bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, const String &p_error) {
//break because of parse error
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_node = p_node;
_debug_parse_err_file = p_file;
_debug_error = p_error;
- ScriptDebugger::get_singleton()->debug(this, false, true);
+ EngineDebugger::get_script_debugger()->debug(this, false, true);
return true;
} else {
return false;
@@ -2607,12 +2607,12 @@ bool VisualScriptLanguage::debug_break_parse(const String &p_file, int p_node, c
bool VisualScriptLanguage::debug_break(const String &p_error, bool p_allow_continue) {
- if (ScriptDebugger::get_singleton() && Thread::get_caller_id() == Thread::get_main_id()) {
+ if (EngineDebugger::is_active() && Thread::get_caller_id() == Thread::get_main_id()) {
_debug_parse_err_node = -1;
_debug_parse_err_file = "";
_debug_error = p_error;
- ScriptDebugger::get_singleton()->debug(this, p_allow_continue, true);
+ EngineDebugger::get_script_debugger()->debug(this, p_allow_continue, true);
return true;
} else {
return false;
@@ -2837,7 +2837,7 @@ VisualScriptLanguage::VisualScriptLanguage() {
int dmcs = GLOBAL_DEF("debug/settings/visual_script/max_call_stack", 1024);
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/visual_script/max_call_stack", PropertyInfo(Variant::INT, "debug/settings/visual_script/max_call_stack", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); //minimum is 1024
- if (ScriptDebugger::get_singleton()) {
+ if (EngineDebugger::is_active()) {
//debugging enabled!
_debug_max_call_stack = dmcs;
_call_stack = memnew_arr(CallLevel, _debug_max_call_stack + 1);
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 0a6daba64f..d1005c025c 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -31,6 +31,8 @@
#ifndef VISUAL_SCRIPT_H
#define VISUAL_SCRIPT_H
+#include "core/debugger/engine_debugger.h"
+#include "core/debugger/script_debugger.h"
#include "core/os/thread.h"
#include "core/script_language.h"
@@ -540,13 +542,13 @@ public:
if (Thread::get_main_id() != Thread::get_caller_id())
return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
- ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() + 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() + 1);
if (_debug_call_stack_pos >= _debug_max_call_stack) {
//stack overflow
_debug_error = "Stack Overflow (Stack Size: " + itos(_debug_max_call_stack) + ")";
- ScriptDebugger::get_singleton()->debug(this);
+ EngineDebugger::get_script_debugger()->debug(this);
return;
}
@@ -563,13 +565,13 @@ public:
if (Thread::get_main_id() != Thread::get_caller_id())
return; //no support for other threads than main for now
- if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
- ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() - 1);
+ if (EngineDebugger::get_script_debugger()->get_lines_left() > 0 && EngineDebugger::get_script_debugger()->get_depth() >= 0)
+ EngineDebugger::get_script_debugger()->set_depth(EngineDebugger::get_script_debugger()->get_depth() - 1);
if (_debug_call_stack_pos == 0) {
_debug_error = "Stack Underflow (Engine Bug)";
- ScriptDebugger::get_singleton()->debug(this);
+ EngineDebugger::get_script_debugger()->debug(this);
return;
}