io ¤
For our REPL, we need to drive our own I/O with the process being debugged. This module contains all the strategies we have for doing that.
Classes:
-
OpportunisticTerminalControl
–Handles optional terminal control for a given file descriptor. Crucially,
-
IODriver
– -
IODriverPlainText
–Plaintext-based I/O driver. It simply copies input from our standard input
-
IODriverPseudoTerminal
–pty-based I/O driver. Forwards input from standard input and has support for
Functions:
-
get_io_driver
–Instances a new IODriver using the best strategy available in the current
-
make_pty
–We need to make a pseudo-terminal ourselves if we want the process to handle
Attributes:
-
TERM_CONTROL_AVAILABLE
– -
SELECT_AVAILABLE
– -
PTY_AVAILABLE
– -
TC_LFLAG
– -
LIVE_PSEUDO_TERMINAL_OBJECTS
–
OpportunisticTerminalControl ¤
Handles optional terminal control for a given file descriptor. Crucially, all the functions in this class should work regardless of whether terminal control is actually supported on not, but should do nothing in case it is not supported.
'/dev/tty', and use that.
Methods:
-
get_line_buffering
–Gets the current state of line buffering for this terminal.
-
set_line_buffering
–Enables or disables line buffering for this terminal.
-
get_echo
–Gets the current state of echoing for this terminal.
-
set_echo
–Enables or disables echoing for this terminal.
Attributes:
IODriver ¤
Methods:
-
stdio
–The names for the stdin, stdout and stderr files, respectively. These
-
start
–Starts the handling of I/O by this driver on the given process.
-
stop
–Stops the handling of I/O by this driver.
-
on_output_event
–Hints that there might be data in either the standard output or the
-
on_process_start
–Allow the I/O driver an opportunity to change aspects of the process
stdio ¤
The names for the stdin, stdout and stderr files, respectively. These will get passed as arguments to SBTarget.Launch
start ¤
Starts the handling of I/O by this driver on the given process.
on_output_event ¤
Hints that there might be data in either the standard output or the standard error streams. This should be called when an eBroadcastBitSTDOUT
or eBroadcastBitSTDERR
is encountered by the event loop.
on_process_start ¤
Allow the I/O driver an opportunity to change aspects of the process after it has been launched, but before it has started executing, if it so wishes.
IODriverPlainText ¤
Bases: IODriver
Plaintext-based I/O driver. It simply copies input from our standard input to the standard input of a given process, and copies output from the standard output of a given process to out standard output.
Methods:
-
stdio
– -
on_output_event
– -
on_process_start
– -
start
– -
stop
–
Attributes:
-
in_thr
(Thread
) – -
out_thr
(Thread
) – -
likely_output
(BoundedSemaphore
) – -
process
(SBProcess
) – -
stop_requested
(Event
) –
IODriverPseudoTerminal ¤
Bases: IODriver
pty-based I/O driver. Forwards input from standard input and has support for terminal width and height, and for terminal-based file operations on the program being debugged.
Methods:
-
stdio
– -
start
– -
stop
– -
on_output_event
– -
on_process_start
–
Attributes:
-
io_thread
(Thread
) – -
has_terminal_control
(bool
) – -
manager
(int
) – -
worker
(str
) – -
termcontrol
(OpportunisticTerminalControl
) – -
stop_requested
(Event
) – -
input_buffer
(bytes
) – -
process
(SBProcess
) –
termcontrol instance-attribute
¤
termcontrol: OpportunisticTerminalControl = OpportunisticTerminalControl()
get_io_driver ¤
get_io_driver() -> IODriver
Instances a new IODriver using the best strategy available in the current system. Meaning a PTY on Unix and plain text on Windows.
make_pty ¤
We need to make a pseudo-terminal ourselves if we want the process to handle naturally for the user. Returns a tuple with the path of the worker device and the file descriptor of the manager device if successful.