Debian Codegraph @

editor/debugger/editor_debugger_plugin.h

raw symbols SCIP
1 /**************************************************************************/
2 /* editor_debugger_plugin.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
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 };