GraphDebugLink
Inherits: RefCounted < Object
Description
Section titled “Description”The editor’s end of the debug channel to a running game.
Listens on the loopback address for a game that was started with --remote-debug set to the address of the link, such as tcp://127.0.0.1:6007. The link keeps what the game last said as one state, and sends the game commands. One game is attached at a time, and a game that connects while another is attached replaces it.
Call poll() often. Read the state with get_state().
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| int | get_port() const |
| String | get_state() const |
| Error | listen(port: int) |
| void | poll() |
| void | request_variables(level: int) |
| void | request_wire(level: int, step: int, port: int) |
| void | send_command(command: String) |
| void | set_breakpoint(source: String, step: int, set: bool) |
Method descriptions
Section titled “Method descriptions”get_port
int get_port() const
Returns the port the game connects to, or 0 when the link does not listen.
get_state
String get_state() const
Returns what the game last said, as JSON text. The keys are connected, stopped, reason, stack, level, locals, members and wire. stack lists objects with source, line and function, innermost first. For a graph script the source is the script path and the function joined by #, and the line is the step number. locals and members list objects with name and value for level. wire is an empty object until request_wire() is answered, then it holds level, step, port and value.
The state is cleared when the game goes away or runs on.
listen
Starts listening on the loopback address. Port 0 lets the system pick one, and get_port() says which. Returns an Error code.
poll
void poll()
Takes in what the game said since the last call, and accepts a game that is waiting to connect.
request_variables
void request_variables(level: int)
Asks the game for the locals and members of level of the stack, the innermost level first. The reply replaces the ones in the state.
request_wire
void request_wire(level: int, step: int, port: int)
Asks the game for the value on input port of step at level of the stack. The reply sets wire in the state. It is empty when the step has not run or the input is not there.
send_command
void send_command(command: String)
Sends "step", "next", "out", "continue" or "break". Step goes into a call, next goes over it and out leaves it. Break stops a game that is running. Any other text prints an error and sends nothing.
set_breakpoint
void set_breakpoint(source: String, step: int, set: bool)
Sets or clears a breakpoint on step of source, which is a script path and a function joined by #.
