LLDB mainline
lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect Class Reference

A Python sys.stdout/stderr file backed by a pipe whose read end is drained by a reader thread that writes to the debugger's terminal under the output lock (Debugger::PrintAsync). More...

Public Member Functions

 ~SessionIORedirect ()
int GetWriteDescriptor () const

Static Public Member Functions

static std::unique_ptr< SessionIORedirectCreate (lldb::user_id_t debugger_id, bool is_stdout)

Private Member Functions

 SessionIORedirect (lldb::user_id_t debugger_id, bool is_stdout)

Static Private Member Functions

static void ReadThreadBytesReceived (void *baton, const void *src, size_t src_len)

Private Attributes

lldb::user_id_t m_debugger_id
bool m_is_stdout
lldb::FileSP m_write_file_sp
ThreadedCommunication m_communication
bool m_connected = false

Detailed Description

A Python sys.stdout/stderr file backed by a pipe whose read end is drained by a reader thread that writes to the debugger's terminal under the output lock (Debugger::PrintAsync).

Handing Python the raw terminal descriptor instead lets a script's print() race the statusline, which redraws on the event thread under that lock. Its cursor save/restore then rewinds over and eats the script's output.

Definition at line 817 of file ScriptInterpreterPython.cpp.

Constructor & Destructor Documentation

◆ ~SessionIORedirect()

lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::~SessionIORedirect ( )
inline

Definition at line 855 of file ScriptInterpreterPython.cpp.

References m_communication, m_connected, and m_write_file_sp.

◆ SessionIORedirect()

lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::SessionIORedirect ( lldb::user_id_t debugger_id,
bool is_stdout )
inlineprivate

Definition at line 871 of file ScriptInterpreterPython.cpp.

References m_communication, m_debugger_id, and m_is_stdout.

Referenced by Create(), and ReadThreadBytesReceived().

Member Function Documentation

◆ Create()

◆ GetWriteDescriptor()

int lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::GetWriteDescriptor ( ) const
inline

◆ ReadThreadBytesReceived()

void lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::ReadThreadBytesReceived ( void * baton,
const void * src,
size_t src_len )
inlinestaticprivate

Member Data Documentation

◆ m_communication

ThreadedCommunication lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::m_communication
private

Definition at line 889 of file ScriptInterpreterPython.cpp.

Referenced by SessionIORedirect(), and ~SessionIORedirect().

◆ m_connected

bool lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::m_connected = false
private

Definition at line 890 of file ScriptInterpreterPython.cpp.

Referenced by ~SessionIORedirect().

◆ m_debugger_id

lldb::user_id_t lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::m_debugger_id
private

Definition at line 886 of file ScriptInterpreterPython.cpp.

Referenced by SessionIORedirect().

◆ m_is_stdout

bool lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::m_is_stdout
private

Definition at line 887 of file ScriptInterpreterPython.cpp.

Referenced by SessionIORedirect().

◆ m_write_file_sp

lldb::FileSP lldb_private::ScriptInterpreterPythonImpl::SessionIORedirect::m_write_file_sp
private

Definition at line 888 of file ScriptInterpreterPython.cpp.

Referenced by GetWriteDescriptor(), and ~SessionIORedirect().


The documentation for this class was generated from the following file: