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.

EngineDebugger

繼承: Object

暴露內部除錯器。

說明

EngineDebugger 處理編輯器與正在運作的遊戲之間的通信。它會在運作遊戲時啟動,可以通過它收發消息,還負責管理性能分析器。

方法

void

clear_breakpoints()

void

debug(can_continue: bool = true, is_error_breakpoint: bool = false)

int

get_depth() const

int

get_lines_left() const

bool

has_capture(name: StringName)

bool

has_profiler(name: StringName)

void

insert_breakpoint(line: int, source: StringName)

bool

is_active()

bool

is_breakpoint(line: int, source: StringName) const

bool

is_profiling(name: StringName)

bool

is_skipping_breakpoints() const

void

line_poll()

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

set_depth(depth: int)

void

set_lines_left(lines: int)

void

unregister_message_capture(name: StringName)

void

unregister_profiler(name: StringName)


方法說明

void clear_breakpoints() 🔗

Clears all breakpoints.


void debug(can_continue: bool = true, is_error_breakpoint: bool = false) 🔗

Starts a debug break in script execution, optionally specifying whether the program can continue based on can_continue and whether the break was due to a breakpoint.


int get_depth() const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

Returns the current debug depth.


int get_lines_left() const 🔗

實驗性: 此方法可能在未來版本中變更或移除。

Returns the number of lines that remain.


bool has_capture(name: StringName) 🔗

如果存在具有給定名稱的捕獲,則返回 true,否則返回 false


bool has_profiler(name: StringName) 🔗

如果存在具有給定名稱的分析器,則返回 true,否則返回 false


void insert_breakpoint(line: int, source: StringName) 🔗

Inserts a new breakpoint with the given source and line.


bool is_active() 🔗

如果除錯器處於活動狀態,則返回 true,否則返回 false


bool is_breakpoint(line: int, source: StringName) const 🔗

Returns true if the given source and line represent an existing breakpoint.


bool is_profiling(name: StringName) 🔗

如果存在具有給定名稱的分析器,並且該分析器處於活動狀態,則返回 true,否則返回 false


bool is_skipping_breakpoints() const 🔗

Returns true if the debugger is skipping breakpoints otherwise false.


void line_poll() 🔗

Forces a processing loop of debugger events. The purpose of this method is just processing events every now and then when the script might get too busy, so that bugs like infinite loops can be caught.


void profiler_add_frame_data(name: StringName, data: Array) 🔗

使用給定的 namedata 呼叫分析器中的 add 可調用體。


void profiler_enable(name: StringName, enable: bool, arguments: Array = []) 🔗

使用給定的 namearguments 呼叫分析器中的 toggle 可呼叫體。會根據 enable 參數啟用/禁用同一分析器。


void register_message_capture(name: StringName, callable: Callable) 🔗

Registers a message capture with given name. If name is "my_message" then messages starting with "my_message:" will be called with the given callable.

The callable must accept a message string and a data array as argument. The callable should return true if the message is recognized.

Note: The callable will receive the message with the prefix stripped, unlike EditorDebuggerPlugin._capture(). See the EditorDebuggerPlugin description for an example.


void register_profiler(name: StringName, profiler: EngineProfiler) 🔗

使用給定的名稱 name 註冊分析器。詳情見 EngineProfiler


void remove_breakpoint(line: int, source: StringName) 🔗

Removes a breakpoint with the given source and line.


void script_debug(language: ScriptLanguage, can_continue: bool = true, is_error_breakpoint: bool = false) 🔗

Starts a debug break in script execution, optionally specifying whether the program can continue based on can_continue and whether the break was due to a breakpoint.


void send_message(message: String, data: Array) 🔗

發送消息,內容為給定的 messagedata 陣列。


void set_depth(depth: int) 🔗

實驗性: 此方法可能在未來版本中變更或移除。

Sets the current debugging depth.


void set_lines_left(lines: int) 🔗

實驗性: 此方法可能在未來版本中變更或移除。

Sets the current debugging lines that remain.


void unregister_message_capture(name: StringName) 🔗

將具有給定名稱 name 的消息捕獲解除註冊。


void unregister_profiler(name: StringName) 🔗

將具有給定名稱 name 的分析器解除註冊。