EditorDebuggerPlugin

Inherits: RefCounted < Object

A base class to implement debugger plugins.

Description

EditorDebuggerPlugin provides functions related to the editor side of the debugger.

To interact with the debugger, an instance of this class must be added to the editor via EditorPlugin.add_debugger_plugin.

Once added, the _setup_session callback will be called for every EditorDebuggerSession available to the plugin, and when new ones are created (the sessions may be inactive during this stage).

You can retrieve the available EditorDebuggerSessions via get_sessions or get a specific one via get_session.

GDScript

  1. @tool
  2. extends EditorPlugin
  3. class ExampleEditorDebugger extends EditorDebuggerPlugin:
  4. func _has_capture(prefix):
  5. # Return true if you wish to handle message with this prefix.
  6. return prefix == "my_plugin"
  7. func _capture(message, data, session_id):
  8. if message == "my_plugin:ping":
  9. get_session(session_id).send_message("my_plugin:echo", data)
  10. func _setup_session(session_id):
  11. # Add a new tab in the debugger session UI containing a label.
  12. var label = Label.new()
  13. label.name = "Example plugin"
  14. label.text = "Example plugin"
  15. var session = get_session(session_id)
  16. # Listens to the session started and stopped signals.
  17. session.started.connect(func (): print("Session started"))
  18. session.stopped.connect(func (): print("Session stopped"))
  19. session.add_session_tab(label)
  20. var debugger = ExampleEditorDebugger.new()
  21. func _enter_tree():
  22. add_debugger_plugin(debugger)
  23. func _exit_tree():
  24. remove_debugger_plugin(debugger)

Methods

void

_breakpoint_set_in_tree(script: Script, line: int, enabled: bool) virtual

void

_breakpoints_cleared_in_tree() virtual

bool

_capture(message: String, data: Array, session_id: int) virtual

void

_goto_script_line(script: Script, line: int) virtual

bool

_has_capture(capture: String) virtual const

void

_setup_session(session_id: int) virtual

EditorDebuggerSession

get_session(id: int)

Array

get_sessions()


Method Descriptions

void _breakpoint_set_in_tree(script: Script, line: int, enabled: bool) virtual 🔗

Override this method to be notified when a breakpoint is set in the editor.


void _breakpoints_cleared_in_tree() virtual 🔗

Override this method to be notified when all breakpoints are cleared in the editor.


bool _capture(message: String, data: Array, session_id: int) virtual 🔗

Override this method to process incoming messages. The session_id is the ID of the EditorDebuggerSession that received the message (which you can retrieve via get_session).


void _goto_script_line(script: Script, line: int) virtual 🔗

Override this method to be notified when a breakpoint line has been clicked in the debugger breakpoint panel.


bool _has_capture(capture: String) virtual const 🔗

Override this method to enable receiving messages from the debugger. If capture is “my_message” then messages starting with “my_message:” will be passes to the _capture method.


void _setup_session(session_id: int) virtual 🔗

Override this method to be notified whenever a new EditorDebuggerSession is created (the session may be inactive during this stage).


EditorDebuggerSession get_session(id: int) 🔗

Returns the EditorDebuggerSession with the given id.


Array get_sessions() 🔗

Returns an array of EditorDebuggerSession currently available to this debugger plugin.

Note: Sessions in the array may be inactive, check their state via EditorDebuggerSession.is_active.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.

Previous Next