Index · Object → RefCounted → ScriptBacktrace

ScriptBacktrace

A captured backtrace of a specific script language.

Class Description

ScriptBacktrace holds an already captured backtrace of a specific script language, such as GDScript or C#, which are captured using Engine.capture_script_backtraces().

See ProjectSettings.debug/settings/gdscript/always_track_call_stacks and ProjectSettings.debug/settings/gdscript/always_track_local_variables for ways of controlling the contents of this class.

Methods

func format(indent_all: int = 0, indent_frames: int = 4) -> String

Converts the backtrace to a String, where the entire string will be indented by indent_all number of spaces, and the individual stack frames will be additionally indented by indent_frames number of spaces.

Note: Calling Object.to_string() on a ScriptBacktrace will produce the same output as calling format() with all parameters left at their default values.

func get_frame_count() -> int

Returns the number of stack frames in the backtrace.

func get_frame_file(index: int) -> String

Returns the file name of the call site represented by the stack frame at the specified index.

func get_frame_function(index: int) -> String

Returns the name of the function called at the stack frame at the specified index.

func get_frame_line(index: int) -> int

Returns the line number of the call site represented by the stack frame at the specified index.

func get_global_variable_count() -> int

Returns the number of global variables (e.g. autoload singletons) in the backtrace.

Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.capture_script_backtraces().

func get_global_variable_name(variable_index: int) -> String

Returns the name of the global variable at the specified index.

func get_global_variable_value(variable_index: int) -> Variant

Returns the value of the global variable at the specified index.

Warning: With GDScript backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.

func get_language_name() -> String

Returns the name of the script language that this backtrace was captured from.

func get_local_variable_count(frame_index: int) -> int

Returns the number of local variables in the stack frame at the specified index.

Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.capture_script_backtraces().

func get_local_variable_name(frame_index: int, variable_index: int) -> String

Returns the name of the local variable at the specified variable_index in the stack frame at the specified frame_index.

func get_local_variable_value(frame_index: int, variable_index: int) -> Variant

Returns the value of the local variable at the specified variable_index in the stack frame at the specified frame_index.

Warning: With GDScript backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.

func get_member_variable_count(frame_index: int) -> int

Returns the number of member variables in the stack frame at the specified index.

Note: This will be non-zero only if the include_variables parameter was true when capturing the backtrace with Engine.capture_script_backtraces().

func get_member_variable_name(frame_index: int, variable_index: int) -> String

Returns the name of the member variable at the specified variable_index in the stack frame at the specified frame_index.

func get_member_variable_value(frame_index: int, variable_index: int) -> Variant

Returns the value of the member variable at the specified variable_index in the stack frame at the specified frame_index.

Warning: With GDScript backtraces, the returned Variant will be the variable's actual value, including any object references. This means that storing the returned Variant will prevent any such object from being deallocated, so it's generally recommended not to do so.

func is_empty() -> bool

Returns true if the backtrace has no stack frames.

Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

Inherited from Object (2)