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:
@@ -32,6 +32,8 @@
|
||||
|
||||
#ifdef UNIX_ENABLED
|
||||
|
||||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/debugger/script_debugger.h"
|
||||
#include "core/os/thread_dummy.h"
|
||||
#include "core/project_settings.h"
|
||||
#include "drivers/unix/dir_access_unix.h"
|
||||
@@ -94,16 +96,16 @@ void OS_Unix::debug_break() {
|
||||
};
|
||||
|
||||
static void handle_interrupt(int sig) {
|
||||
if (ScriptDebugger::get_singleton() == NULL)
|
||||
if (!EngineDebugger::is_active())
|
||||
return;
|
||||
|
||||
ScriptDebugger::get_singleton()->set_depth(-1);
|
||||
ScriptDebugger::get_singleton()->set_lines_left(1);
|
||||
EngineDebugger::get_script_debugger()->set_depth(-1);
|
||||
EngineDebugger::get_script_debugger()->set_lines_left(1);
|
||||
}
|
||||
|
||||
void OS_Unix::initialize_debugging() {
|
||||
|
||||
if (ScriptDebugger::get_singleton() != NULL) {
|
||||
if (EngineDebugger::is_active()) {
|
||||
struct sigaction action;
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = handle_interrupt;
|
||||
|
||||
Reference in New Issue
Block a user