You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
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.
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#include "script_language.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/debugger/script_debugger.h"
|
||||
#include "core/project_settings.h"
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -46,8 +48,8 @@ void Script::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
||||
|
||||
if (ScriptDebugger::get_singleton())
|
||||
ScriptDebugger::get_singleton()->set_break_language(get_language());
|
||||
if (EngineDebugger::is_active())
|
||||
EngineDebugger::get_script_debugger()->set_break_language(get_language());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,89 +358,6 @@ ScriptCodeCompletionCache::ScriptCodeCompletionCache() {
|
||||
void ScriptLanguage::frame() {
|
||||
}
|
||||
|
||||
ScriptDebugger *ScriptDebugger::singleton = NULL;
|
||||
|
||||
void ScriptDebugger::set_lines_left(int p_left) {
|
||||
|
||||
lines_left = p_left;
|
||||
}
|
||||
|
||||
int ScriptDebugger::get_lines_left() const {
|
||||
|
||||
return lines_left;
|
||||
}
|
||||
|
||||
void ScriptDebugger::set_depth(int p_depth) {
|
||||
|
||||
depth = p_depth;
|
||||
}
|
||||
|
||||
int ScriptDebugger::get_depth() const {
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
void ScriptDebugger::insert_breakpoint(int p_line, const StringName &p_source) {
|
||||
|
||||
if (!breakpoints.has(p_line))
|
||||
breakpoints[p_line] = Set<StringName>();
|
||||
breakpoints[p_line].insert(p_source);
|
||||
}
|
||||
|
||||
void ScriptDebugger::remove_breakpoint(int p_line, const StringName &p_source) {
|
||||
|
||||
if (!breakpoints.has(p_line))
|
||||
return;
|
||||
|
||||
breakpoints[p_line].erase(p_source);
|
||||
if (breakpoints[p_line].size() == 0)
|
||||
breakpoints.erase(p_line);
|
||||
}
|
||||
bool ScriptDebugger::is_breakpoint(int p_line, const StringName &p_source) const {
|
||||
|
||||
if (!breakpoints.has(p_line))
|
||||
return false;
|
||||
return breakpoints[p_line].has(p_source);
|
||||
}
|
||||
bool ScriptDebugger::is_breakpoint_line(int p_line) const {
|
||||
|
||||
return breakpoints.has(p_line);
|
||||
}
|
||||
|
||||
String ScriptDebugger::breakpoint_find_source(const String &p_source) const {
|
||||
|
||||
return p_source;
|
||||
}
|
||||
|
||||
void ScriptDebugger::clear_breakpoints() {
|
||||
|
||||
breakpoints.clear();
|
||||
}
|
||||
|
||||
void ScriptDebugger::idle_poll() {
|
||||
}
|
||||
|
||||
void ScriptDebugger::line_poll() {
|
||||
}
|
||||
|
||||
void ScriptDebugger::set_break_language(ScriptLanguage *p_lang) {
|
||||
|
||||
break_lang = p_lang;
|
||||
}
|
||||
|
||||
ScriptLanguage *ScriptDebugger::get_break_language() const {
|
||||
|
||||
return break_lang;
|
||||
}
|
||||
|
||||
ScriptDebugger::ScriptDebugger() {
|
||||
|
||||
singleton = this;
|
||||
lines_left = -1;
|
||||
depth = -1;
|
||||
break_lang = NULL;
|
||||
}
|
||||
|
||||
bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
if (script->is_placeholder_fallback_enabled())
|
||||
|
||||
Reference in New Issue
Block a user