diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2020-02-27 03:30:20 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2020-03-08 12:36:39 +0100 |
commit | b8ddaf9c33107e01928e04ed462aa08d4017247b (patch) | |
tree | 6ab71cdcbfd372e8390baa6ac30a2974fe43d119 /modules/gdscript/gdscript_function.cpp | |
parent | d0009636df6544dd26ab7c568a0244af6a20634a (diff) | |
download | redot-engine-b8ddaf9c33107e01928e04ed462aa08d4017247b.tar.gz |
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/gdscript/gdscript_function.cpp')
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
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 |