| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="ScriptBacktrace" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A captured backtrace of a specific script language. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | [ScriptBacktrace] holds an already captured backtrace of a specific script language, such as GDScript or C#, which are captured using [method Engine.capture_script_backtraces]. |
| 8 | See [member ProjectSettings.debug/settings/gdscript/always_track_call_stacks] and [member ProjectSettings.debug/settings/gdscript/always_track_local_variables] for ways of controlling the contents of this class. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="format" qualifiers="const"> |
| 14 | <return type="String" /> |
| 15 | <param index="0" name="indent_all" type="int" default="0" /> |
| 16 | <param index="1" name="indent_frames" type="int" default="4" /> |
| 17 | <description> |
| 18 | Converts the backtrace to a [String], where the entire string will be indented by [param indent_all] number of spaces, and the individual stack frames will be additionally indented by [param indent_frames] number of spaces. |
| 19 | [b]Note:[/b] Calling [method Object.to_string] on a [ScriptBacktrace] will produce the same output as calling [method format] with all parameters left at their default values. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="get_frame_count" qualifiers="const"> |
| 23 | <return type="int" /> |
| 24 | <description> |
| 25 | Returns the number of stack frames in the backtrace. |
| 26 | </description> |
| 27 | </method> |
| 28 | <method name="get_frame_file" qualifiers="const"> |
| 29 | <return type="String" /> |
| 30 | <param index="0" name="index" type="int" /> |
| 31 | <description> |
| 32 | Returns the file name of the call site represented by the stack frame at the specified index. |
| 33 | </description> |
| 34 | </method> |
| 35 | <method name="get_frame_function" qualifiers="const"> |
| 36 | <return type="String" /> |
| 37 | <param index="0" name="index" type="int" /> |
| 38 | <description> |
| 39 | Returns the name of the function called at the stack frame at the specified index. |
| 40 | </description> |
| 41 | </method> |
| 42 | <method name="get_frame_line" qualifiers="const"> |
| 43 | <return type="int" /> |
| 44 | <param index="0" name="index" type="int" /> |
| 45 | <description> |
| 46 | Returns the line number of the call site represented by the stack frame at the specified index. |
| 47 | </description> |
| 48 | </method> |
| 49 | <method name="get_global_variable_count" qualifiers="const"> |
| 50 | <return type="int" /> |
| 51 | <description> |
| 52 | Returns the number of global variables (e.g. autoload singletons) in the backtrace. |
| 53 | [b]Note:[/b] This will be non-zero only if the [code]include_variables[/code] parameter was [code]true[/code] when capturing the backtrace with [method Engine.capture_script_backtraces]. |
| 54 | </description> |
| 55 | </method> |
| 56 | <method name="get_global_variable_name" qualifiers="const"> |
| 57 | <return type="String" /> |
| 58 | <param index="0" name="variable_index" type="int" /> |
| 59 | <description> |
| 60 | Returns the name of the global variable at the specified index. |
| 61 | </description> |
| 62 | </method> |
| 63 | <method name="get_global_variable_value" qualifiers="const"> |
| 64 | <return type="Variant" /> |
| 65 | <param index="0" name="variable_index" type="int" /> |
| 66 | <description> |
| 67 | Returns the value of the global variable at the specified index. |
| 68 | [b]Warning:[/b] 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. |
| 69 | </description> |
| 70 | </method> |
| 71 | <method name="get_language_name" qualifiers="const"> |
| 72 | <return type="String" /> |
| 73 | <description> |
| 74 | Returns the name of the script language that this backtrace was captured from. |
| 75 | </description> |
| 76 | </method> |
| 77 | <method name="get_local_variable_count" qualifiers="const"> |
| 78 | <return type="int" /> |
| 79 | <param index="0" name="frame_index" type="int" /> |
| 80 | <description> |
| 81 | Returns the number of local variables in the stack frame at the specified index. |
| 82 | [b]Note:[/b] This will be non-zero only if the [code]include_variables[/code] parameter was [code]true[/code] when capturing the backtrace with [method Engine.capture_script_backtraces]. |
| 83 | </description> |
| 84 | </method> |
| 85 | <method name="get_local_variable_name" qualifiers="const"> |
| 86 | <return type="String" /> |
| 87 | <param index="0" name="frame_index" type="int" /> |
| 88 | <param index="1" name="variable_index" type="int" /> |
| 89 | <description> |
| 90 | Returns the name of the local variable at the specified [param variable_index] in the stack frame at the specified [param frame_index]. |
| 91 | </description> |
| 92 | </method> |
| 93 | <method name="get_local_variable_value" qualifiers="const"> |
| 94 | <return type="Variant" /> |
| 95 | <param index="0" name="frame_index" type="int" /> |
| 96 | <param index="1" name="variable_index" type="int" /> |
| 97 | <description> |
| 98 | Returns the value of the local variable at the specified [param variable_index] in the stack frame at the specified [param frame_index]. |
| 99 | [b]Warning:[/b] 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. |
| 100 | </description> |
| 101 | </method> |
| 102 | <method name="get_member_variable_count" qualifiers="const"> |
| 103 | <return type="int" /> |
| 104 | <param index="0" name="frame_index" type="int" /> |
| 105 | <description> |
| 106 | Returns the number of member variables in the stack frame at the specified index. |
| 107 | [b]Note:[/b] This will be non-zero only if the [code]include_variables[/code] parameter was [code]true[/code] when capturing the backtrace with [method Engine.capture_script_backtraces]. |
| 108 | </description> |
| 109 | </method> |
| 110 | <method name="get_member_variable_name" qualifiers="const"> |
| 111 | <return type="String" /> |
| 112 | <param index="0" name="frame_index" type="int" /> |
| 113 | <param index="1" name="variable_index" type="int" /> |
| 114 | <description> |
| 115 | Returns the name of the member variable at the specified [param variable_index] in the stack frame at the specified [param frame_index]. |
| 116 | </description> |
| 117 | </method> |
| 118 | <method name="get_member_variable_value" qualifiers="const"> |
| 119 | <return type="Variant" /> |
| 120 | <param index="0" name="frame_index" type="int" /> |
| 121 | <param index="1" name="variable_index" type="int" /> |
| 122 | <description> |
| 123 | Returns the value of the member variable at the specified [param variable_index] in the stack frame at the specified [param frame_index]. |
| 124 | [b]Warning:[/b] 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. |
| 125 | </description> |
| 126 | </method> |
| 127 | <method name="is_empty" qualifiers="const"> |
| 128 | <return type="bool" /> |
| 129 | <description> |
| 130 | Returns [code]true[/code] if the backtrace has no stack frames. |
| 131 | </description> |
| 132 | </method> |
| 133 | </methods> |
| 134 | </class> |