Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EngineDebugger
继承: Object
暴露内部调试器。
描述
EngineDebugger 处理编辑器与正在运行的游戏之间的通信。它会在运行游戏时激活,可以通过它收发消息,还负责管理性能分析器。
方法
void |
|
void |
debug(can_continue: bool = true, is_error_breakpoint: bool = false) |
get_depth() const |
|
get_lines_left() const |
|
has_capture(name: StringName) |
|
has_profiler(name: StringName) |
|
void |
insert_breakpoint(line: int, source: StringName) |
is_breakpoint(line: int, source: StringName) const |
|
is_profiling(name: StringName) |
|
is_skipping_breakpoints() const |
|
void |
|
void |
profiler_add_frame_data(name: StringName, data: Array) |
void |
profiler_enable(name: StringName, enable: bool, arguments: Array = []) |
void |
register_message_capture(name: StringName, callable: Callable) |
void |
register_profiler(name: StringName, profiler: EngineProfiler) |
void |
remove_breakpoint(line: int, source: StringName) |
void |
script_debug(language: ScriptLanguage, can_continue: bool = true, is_error_breakpoint: bool = false) |
void |
send_message(message: String, data: Array) |
void |
|
void |
set_lines_left(lines: int) |
void |
|
void |
unregister_profiler(name: StringName) |
方法说明
void clear_breakpoints() 🔗
清除所有断点。
void debug(can_continue: bool = true, is_error_breakpoint: bool = false) 🔗
在运行脚本时触发调试中断,可以使用 can_continue
指定程序是否能够继续运行,还可以指定该中断是否是由断点导致的。
实验性: 未来版本中可能会修改或移除该方法。
返回当前调试深度。
实验性: 未来版本中可能会修改或移除该方法。
返回剩余的行数。
bool has_capture(name: StringName) 🔗
如果存在具有给定名称的捕获,则返回 true
,否则返回 false
。
bool has_profiler(name: StringName) 🔗
如果存在具有给定名称的分析器,则返回 true
,否则返回 false
。
void insert_breakpoint(line: int, source: StringName) 🔗
使用给定的 source
和 line
插入一个新断点。
如果调试器处于活动状态,则返回 true
,否则返回 false
。
bool is_breakpoint(line: int, source: StringName) const 🔗
如果给定的 source
和 line
代表一个已存在的断点,则返回 true
。
bool is_profiling(name: StringName) 🔗
如果存在具有给定名称的分析器,并且该分析器处于活动状态,则返回 true
,否则返回 false
。
bool is_skipping_breakpoints() const 🔗
如果调试器跳过断点,则返回 true
,否则返回 false
。
void line_poll() 🔗
强制调试器事件的一个处理循环。该方法的目的是当脚本可能过于繁忙时不时地处理事件,以便可以捕获无限循环之类的错误。
void profiler_add_frame_data(name: StringName, data: Array) 🔗
使用给定的 name
和 data
调用分析器中的 add
可调用体。
void profiler_enable(name: StringName, enable: bool, arguments: Array = []) 🔗
使用给定的 name
和 arguments
调用分析器中的 toggle
可调用体。会根据 enable
参数启用/禁用同一分析器。
void register_message_capture(name: StringName, callable: Callable) 🔗
使用名称 name
注册消息捕获。如果 name
为“my_message”则会为“my_message:”开头的消息调用给定的可调用体。
可调用体必须接受消息字符串和数据数组参数。如果能够识别该消息,则可调用体应返回 true
。
注意:可调用体收到的消息已剥离前缀,这一点与 EditorDebuggerPlugin._capture() 不同。示例见 EditorDebuggerPlugin 的描述。
void register_profiler(name: StringName, profiler: EngineProfiler) 🔗
使用给定的名称 name
注册分析器。详见 EngineProfiler。
void remove_breakpoint(line: int, source: StringName) 🔗
使用给定的 source
和 line
移除一个断点。
void script_debug(language: ScriptLanguage, can_continue: bool = true, is_error_breakpoint: bool = false) 🔗
在运行脚本时触发调试中断,可以使用 can_continue
指定程序是否能够继续运行,还可以指定该中断是否是由断点导致的。
void send_message(message: String, data: Array) 🔗
发送消息,内容为给定的 message
和 data
数组。
实验性: 未来版本中可能会修改或移除该方法。
设置当前调试深度。
void set_lines_left(lines: int) 🔗
实验性: 未来版本中可能会修改或移除该方法。
设置当前剩余的调试行。
void unregister_message_capture(name: StringName) 🔗
将具有给定名称 name
的消息捕获解除注册。
void unregister_profiler(name: StringName) 🔗
将具有给定名称 name
的分析器解除注册。