| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/gui/control.h" |
| 34 |
|
| 35 |
class ScriptEditorDebugger; |
| 36 |
|
| 37 |
class EditorDebuggerSession : public RefCounted { |
| 38 |
GDCLASS(EditorDebuggerSession, RefCounted); |
| 39 |
|
| 40 |
private: |
| 41 |
HashSet<Control *> tabs; |
| 42 |
|
| 43 |
ScriptEditorDebugger *debugger = nullptr; |
| 44 |
|
| 45 |
void _breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump); |
| 46 |
void _started(); |
| 47 |
void _stopped(); |
| 48 |
void _debugger_gone_away(); |
| 49 |
|
| 50 |
protected: |
| 51 |
static void _bind_methods(); |
| 52 |
|
| 53 |
public: |
| 54 |
void detach_debugger(); |
| 55 |
|
| 56 |
void add_session_tab(Control *p_tab); |
| 57 |
void remove_session_tab(Control *p_tab); |
| 58 |
void send_message(const String &p_message, const Array &p_args = Array()); |
| 59 |
void toggle_profiler(const String &p_profiler, bool p_enable, const Array &p_data = Array()); |
| 60 |
bool is_breaked(); |
| 61 |
bool is_debuggable(); |
| 62 |
bool is_active(); |
| 63 |
|
| 64 |
void set_breakpoint(const String &p_path, int p_line, bool p_enabled); |
| 65 |
|
| 66 |
EditorDebuggerSession(ScriptEditorDebugger *p_debugger); |
| 67 |
~EditorDebuggerSession(); |
| 68 |
}; |
| 69 |
|
| 70 |
class EditorDebuggerPlugin : public RefCounted { |
| 71 |
GDCLASS(EditorDebuggerPlugin, RefCounted); |
| 72 |
|
| 73 |
private: |
| 74 |
List<Ref<EditorDebuggerSession>> sessions; |
| 75 |
|
| 76 |
protected: |
| 77 |
static void _bind_methods(); |
| 78 |
|
| 79 |
public: |
| 80 |
void create_session(ScriptEditorDebugger *p_debugger); |
| 81 |
void clear(); |
| 82 |
|
| 83 |
virtual void setup_session(int p_idx); |
| 84 |
virtual bool capture(const String &p_message, const Array &p_data, int p_session); |
| 85 |
virtual bool has_capture(const String &p_capture) const; |
| 86 |
|
| 87 |
Ref<EditorDebuggerSession> get_session(int p_session_id); |
| 88 |
Array get_sessions(); |
| 89 |
|
| 90 |
GDVIRTUAL3R(bool, _capture, const String &, const Array &, int); |
| 91 |
GDVIRTUAL1RC(bool, _has_capture, const String &); |
| 92 |
GDVIRTUAL1(_setup_session, int); |
| 93 |
|
| 94 |
virtual void goto_script_line(const Ref<Script> &p_script, int p_line); |
| 95 |
virtual void breakpoints_cleared_in_tree(); |
| 96 |
virtual void breakpoint_set_in_tree(const Ref<Script> &p_script, int p_line, bool p_enabled); |
| 97 |
|
| 98 |
GDVIRTUAL2(_goto_script_line, const Ref<Script> &, int); |
| 99 |
GDVIRTUAL0(_breakpoints_cleared_in_tree); |
| 100 |
GDVIRTUAL3(_breakpoint_set_in_tree, const Ref<Script> &, int, bool); |
| 101 |
|
| 102 |
EditorDebuggerPlugin(); |
| 103 |
~EditorDebuggerPlugin(); |
| 104 |
}; |