class_scriptbacktrace.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ScriptBacktrace.xml.
  6. .. _class_ScriptBacktrace:
  7. ScriptBacktrace
  8. ===============
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A captured backtrace of a specific script language.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **ScriptBacktrace** holds an already captured backtrace of a specific script language, such as GDScript or C#, which are captured using :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
  15. See :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks<class_ProjectSettings_property_debug/settings/gdscript/always_track_call_stacks>` and :ref:`ProjectSettings.debug/settings/gdscript/always_track_local_variables<class_ProjectSettings_property_debug/settings/gdscript/always_track_local_variables>` for ways of controlling the contents of this class.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_String>` | :ref:`format<class_ScriptBacktrace_method_format>`\ (\ indent_all\: :ref:`int<class_int>` = 0, indent_frames\: :ref:`int<class_int>` = 4\ ) |const| |
  23. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_frame_count<class_ScriptBacktrace_method_get_frame_count>`\ (\ ) |const| |
  25. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`get_frame_file<class_ScriptBacktrace_method_get_frame_file>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  27. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`String<class_String>` | :ref:`get_frame_function<class_ScriptBacktrace_method_get_frame_function>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  29. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_frame_line<class_ScriptBacktrace_method_get_frame_line>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  31. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_global_variable_count<class_ScriptBacktrace_method_get_global_variable_count>`\ (\ ) |const| |
  33. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`get_global_variable_name<class_ScriptBacktrace_method_get_global_variable_name>`\ (\ variable_index\: :ref:`int<class_int>`\ ) |const| |
  35. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Variant<class_Variant>` | :ref:`get_global_variable_value<class_ScriptBacktrace_method_get_global_variable_value>`\ (\ variable_index\: :ref:`int<class_int>`\ ) |const| |
  37. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_language_name<class_ScriptBacktrace_method_get_language_name>`\ (\ ) |const| |
  39. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_local_variable_count<class_ScriptBacktrace_method_get_local_variable_count>`\ (\ frame_index\: :ref:`int<class_int>`\ ) |const| |
  41. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`String<class_String>` | :ref:`get_local_variable_name<class_ScriptBacktrace_method_get_local_variable_name>`\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| |
  43. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Variant<class_Variant>` | :ref:`get_local_variable_value<class_ScriptBacktrace_method_get_local_variable_value>`\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| |
  45. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_member_variable_count<class_ScriptBacktrace_method_get_member_variable_count>`\ (\ frame_index\: :ref:`int<class_int>`\ ) |const| |
  47. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`String<class_String>` | :ref:`get_member_variable_name<class_ScriptBacktrace_method_get_member_variable_name>`\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| |
  49. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Variant<class_Variant>` | :ref:`get_member_variable_value<class_ScriptBacktrace_method_get_member_variable_value>`\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| |
  51. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`is_empty<class_ScriptBacktrace_method_is_empty>`\ (\ ) |const| |
  53. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. .. rst-class:: classref-section-separator
  55. ----
  56. .. rst-class:: classref-descriptions-group
  57. Method Descriptions
  58. -------------------
  59. .. _class_ScriptBacktrace_method_format:
  60. .. rst-class:: classref-method
  61. :ref:`String<class_String>` **format**\ (\ indent_all\: :ref:`int<class_int>` = 0, indent_frames\: :ref:`int<class_int>` = 4\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_format>`
  62. Converts the backtrace to a :ref:`String<class_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.
  63. \ **Note:** Calling :ref:`Object.to_string()<class_Object_method_to_string>` on a **ScriptBacktrace** will produce the same output as calling :ref:`format()<class_ScriptBacktrace_method_format>` with all parameters left at their default values.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_ScriptBacktrace_method_get_frame_count:
  67. .. rst-class:: classref-method
  68. :ref:`int<class_int>` **get_frame_count**\ (\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_frame_count>`
  69. Returns the number of stack frames in the backtrace.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_ScriptBacktrace_method_get_frame_file:
  73. .. rst-class:: classref-method
  74. :ref:`String<class_String>` **get_frame_file**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_frame_file>`
  75. Returns the file name of the call site represented by the stack frame at the specified index.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_ScriptBacktrace_method_get_frame_function:
  79. .. rst-class:: classref-method
  80. :ref:`String<class_String>` **get_frame_function**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_frame_function>`
  81. Returns the name of the function called at the stack frame at the specified index.
  82. .. rst-class:: classref-item-separator
  83. ----
  84. .. _class_ScriptBacktrace_method_get_frame_line:
  85. .. rst-class:: classref-method
  86. :ref:`int<class_int>` **get_frame_line**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_frame_line>`
  87. Returns the line number of the call site represented by the stack frame at the specified index.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_ScriptBacktrace_method_get_global_variable_count:
  91. .. rst-class:: classref-method
  92. :ref:`int<class_int>` **get_global_variable_count**\ (\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_global_variable_count>`
  93. Returns the number of global variables (e.g. autoload singletons) in the backtrace.
  94. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_ScriptBacktrace_method_get_global_variable_name:
  98. .. rst-class:: classref-method
  99. :ref:`String<class_String>` **get_global_variable_name**\ (\ variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_global_variable_name>`
  100. Returns the name of the global variable at the specified index.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_ScriptBacktrace_method_get_global_variable_value:
  104. .. rst-class:: classref-method
  105. :ref:`Variant<class_Variant>` **get_global_variable_value**\ (\ variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_global_variable_value>`
  106. Returns the value of the global variable at the specified index.
  107. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant<class_Variant>` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant<class_Variant>` will prevent any such object from being deallocated, so it's generally recommended not to do so.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_ScriptBacktrace_method_get_language_name:
  111. .. rst-class:: classref-method
  112. :ref:`String<class_String>` **get_language_name**\ (\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_language_name>`
  113. Returns the name of the script language that this backtrace was captured from.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_ScriptBacktrace_method_get_local_variable_count:
  117. .. rst-class:: classref-method
  118. :ref:`int<class_int>` **get_local_variable_count**\ (\ frame_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_local_variable_count>`
  119. Returns the number of local variables in the stack frame at the specified index.
  120. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_ScriptBacktrace_method_get_local_variable_name:
  124. .. rst-class:: classref-method
  125. :ref:`String<class_String>` **get_local_variable_name**\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_local_variable_name>`
  126. Returns the name of the local variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_ScriptBacktrace_method_get_local_variable_value:
  130. .. rst-class:: classref-method
  131. :ref:`Variant<class_Variant>` **get_local_variable_value**\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_local_variable_value>`
  132. Returns the value of the local variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``.
  133. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant<class_Variant>` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant<class_Variant>` will prevent any such object from being deallocated, so it's generally recommended not to do so.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_ScriptBacktrace_method_get_member_variable_count:
  137. .. rst-class:: classref-method
  138. :ref:`int<class_int>` **get_member_variable_count**\ (\ frame_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_member_variable_count>`
  139. Returns the number of member variables in the stack frame at the specified index.
  140. \ **Note:** This will be non-zero only if the ``include_variables`` parameter was ``true`` when capturing the backtrace with :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_ScriptBacktrace_method_get_member_variable_name:
  144. .. rst-class:: classref-method
  145. :ref:`String<class_String>` **get_member_variable_name**\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_member_variable_name>`
  146. Returns the name of the member variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_ScriptBacktrace_method_get_member_variable_value:
  150. .. rst-class:: classref-method
  151. :ref:`Variant<class_Variant>` **get_member_variable_value**\ (\ frame_index\: :ref:`int<class_int>`, variable_index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_get_member_variable_value>`
  152. Returns the value of the member variable at the specified ``variable_index`` in the stack frame at the specified ``frame_index``.
  153. \ **Warning:** With GDScript backtraces, the returned :ref:`Variant<class_Variant>` will be the variable's actual value, including any object references. This means that storing the returned :ref:`Variant<class_Variant>` will prevent any such object from being deallocated, so it's generally recommended not to do so.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_ScriptBacktrace_method_is_empty:
  157. .. rst-class:: classref-method
  158. :ref:`bool<class_bool>` **is_empty**\ (\ ) |const| :ref:`🔗<class_ScriptBacktrace_method_is_empty>`
  159. Returns ``true`` if the backtrace has no stack frames.
  160. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  161. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  162. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  163. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  164. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  165. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  166. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  167. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  168. .. |void| replace:: :abbr:`void (No return value.)`