Up to date

This page is up to date for Godot 4.3. If you still find outdated information, please open an issue.

EngineDebuggerΒΆ

Inherits: Object

Exposes the internal debugger.

DescriptionΒΆ

EngineDebugger handles the communication between the editor and the running game. It is active in the running game. Messages can be sent/received through it. It also manages the profilers.

MethodsΒΆ

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)


Method DescriptionsΒΆ

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 πŸ”—

Experimental: This method may be changed or removed in future versions.

Returns the current debug depth.


int get_lines_left() const πŸ”—

Experimental: This method may be changed or removed in future versions.

Returns the number of lines that remain.


bool has_capture(name: StringName) πŸ”—

Returns true if a capture with the given name is present otherwise false.


bool has_profiler(name: StringName) πŸ”—

Returns true if a profiler with the given name is present otherwise false.


void insert_breakpoint(line: int, source: StringName) πŸ”—

Inserts a new breakpoint with the given source and line.


bool is_active() πŸ”—

Returns true if the debugger is active otherwise 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) πŸ”—

Returns true if a profiler with the given name is present and active otherwise 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) πŸ”—

Calls the add callable of the profiler with given name and data.


void profiler_enable(name: StringName, enable: bool, arguments: Array = []) πŸ”—

Calls the toggle callable of the profiler with given name and arguments. Enables/Disables the same profiler depending on enable argument.


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.

Callable must accept a message string and a data array as argument. If the message and data are valid then callable must return true otherwise false.


void register_profiler(name: StringName, profiler: EngineProfiler) πŸ”—

Registers a profiler with the given name. See EngineProfiler for more information.


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) πŸ”—

Sends a message with given message and data array.


void set_depth(depth: int) πŸ”—

Experimental: This method may be changed or removed in future versions.

Sets the current debugging depth.


void set_lines_left(lines: int) πŸ”—

Experimental: This method may be changed or removed in future versions.

Sets the current debugging lines that remain.


void unregister_message_capture(name: StringName) πŸ”—

Unregisters the message capture with given name.


void unregister_profiler(name: StringName) πŸ”—

Unregisters a profiler with given name.