Path: blob/master/editor/debugger/editor_debugger_plugin.h
9905 views
/**************************************************************************/1/* editor_debugger_plugin.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "scene/gui/control.h"3334class ScriptEditorDebugger;3536class EditorDebuggerSession : public RefCounted {37GDCLASS(EditorDebuggerSession, RefCounted);3839private:40HashSet<Control *> tabs;4142ScriptEditorDebugger *debugger = nullptr;4344void _breaked(bool p_really_did, bool p_can_debug, const String &p_message, bool p_has_stackdump);45void _started();46void _stopped();47void _debugger_gone_away();4849protected:50static void _bind_methods();5152public:53void detach_debugger();5455void add_session_tab(Control *p_tab);56void remove_session_tab(Control *p_tab);57void send_message(const String &p_message, const Array &p_args = Array());58void toggle_profiler(const String &p_profiler, bool p_enable, const Array &p_data = Array());59bool is_breaked();60bool is_debuggable();61bool is_active();6263void set_breakpoint(const String &p_path, int p_line, bool p_enabled);6465EditorDebuggerSession(ScriptEditorDebugger *p_debugger);66~EditorDebuggerSession();67};6869class EditorDebuggerPlugin : public RefCounted {70GDCLASS(EditorDebuggerPlugin, RefCounted);7172private:73List<Ref<EditorDebuggerSession>> sessions;7475protected:76static void _bind_methods();7778public:79void create_session(ScriptEditorDebugger *p_debugger);80void clear();8182virtual void setup_session(int p_idx);83virtual bool capture(const String &p_message, const Array &p_data, int p_session);84virtual bool has_capture(const String &p_capture) const;8586Ref<EditorDebuggerSession> get_session(int p_session_id);87Array get_sessions();8889GDVIRTUAL3R(bool, _capture, const String &, const Array &, int);90GDVIRTUAL1RC(bool, _has_capture, const String &);91GDVIRTUAL1(_setup_session, int);9293virtual void goto_script_line(const Ref<Script> &p_script, int p_line);94virtual void breakpoints_cleared_in_tree();95virtual void breakpoint_set_in_tree(const Ref<Script> &p_script, int p_line, bool p_enabled);9697GDVIRTUAL2(_goto_script_line, const Ref<Script> &, int);98GDVIRTUAL0(_breakpoints_cleared_in_tree);99GDVIRTUAL3(_breakpoint_set_in_tree, const Ref<Script> &, int, bool);100101EditorDebuggerPlugin();102~EditorDebuggerPlugin();103};104105106