LLDB mainline
lldb_private::ConnectionConPTY Class Reference

A read only Connection implementation for the Windows ConPTY. More...

#include <ConnectionConPTYWindows.h>

Inheritance diagram for lldb_private::ConnectionConPTY:
[legend]

Public Member Functions

 ConnectionConPTY (std::shared_ptr< PseudoConsole > pty)
 ~ConnectionConPTY ()
lldb::ConnectionStatus Connect (llvm::StringRef s, Status *error_ptr) override
 Connect using the connect string url.
lldb::ConnectionStatus Disconnect (Status *error_ptr) override
 Disconnect the communications connection if one is currently connected.
size_t Read (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr) override
 Read from the ConPTY's pipe.
size_t Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Status *error_ptr) override
 The actual write function that attempts to write to the communications protocol.
Public Member Functions inherited from lldb_private::ConnectionGenericFile
 ConnectionGenericFile ()
 ConnectionGenericFile (lldb::file_t file, bool owns_file)
 ~ConnectionGenericFile () override
bool IsConnected () const override
 Check if the connection is valid.
lldb::ConnectionStatus Connect (llvm::StringRef s, Status *error_ptr) override
 Connect using the connect string url.
lldb::ConnectionStatus Disconnect (Status *error_ptr) override
 Disconnect the communications connection if one is currently connected.
size_t Read (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr) override
 The read function that attempts to read from the connection.
size_t Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Status *error_ptr) override
 The actual write function that attempts to write to the communications protocol.
std::string GetURI () override
 Returns a URI that describes this connection object.
bool InterruptRead () override
 Interrupts an ongoing Read() operation.
Public Member Functions inherited from lldb_private::Connection
 Connection ()=default
 Default constructor.
virtual ~Connection ()
 Virtual destructor since this class gets subclassed and handed to a Communication object.
virtual lldb::IOObjectSP GetReadObject ()
 Returns the underlying IOObject used by the Connection.

Protected Attributes

std::shared_ptr< PseudoConsolem_pty
bool m_pty_vt_sequence_was_stripped = false
Protected Attributes inherited from lldb_private::ConnectionGenericFile
OVERLAPPED m_overlapped
bool m_read_pending = false
HANDLE m_file
HANDLE m_event_handles [2]
bool m_owns_file
LARGE_INTEGER m_file_position

Additional Inherited Members

Protected Types inherited from lldb_private::ConnectionGenericFile
enum  { kBytesAvailableEvent , kInterruptEvent }

Detailed Description

A read only Connection implementation for the Windows ConPTY.

Definition at line 22 of file ConnectionConPTYWindows.h.

Constructor & Destructor Documentation

◆ ConnectionConPTY()

ConnectionConPTY::ConnectionConPTY ( std::shared_ptr< PseudoConsole > pty)

◆ ~ConnectionConPTY()

ConnectionConPTY::~ConnectionConPTY ( )

Definition at line 49 of file ConnectionConPTYWindows.cpp.

Member Function Documentation

◆ Connect()

lldb::ConnectionStatus ConnectionConPTY::Connect ( llvm::StringRef url,
Status * error_ptr )
overridevirtual

Connect using the connect string url.

Parameters
[in]urlA string that contains all information needed by the subclass to connect to another client.
[out]error_ptrA pointer to an error object that should be given an appropriate error value if this method returns false. This value can be NULL if the error value should be ignored.
Returns
True if the connect succeeded, false otherwise. The internal error object should be filled in with an appropriate value based on the result of this function.
See also
Status& Communication::GetError ();

Implements lldb_private::Connection.

Definition at line 51 of file ConnectionConPTYWindows.cpp.

References lldb::eConnectionStatusNoConnection, lldb::eConnectionStatusSuccess, and m_pty.

◆ Disconnect()

lldb::ConnectionStatus ConnectionConPTY::Disconnect ( Status * error_ptr)
overridevirtual

Disconnect the communications connection if one is currently connected.

Parameters
[out]error_ptrA pointer to an error object that should be given an appropriate error value if this method returns false. This value can be NULL if the error value should be ignored.
Returns
True if the disconnect succeeded, false otherwise. The internal error object should be filled in with an appropriate value based on the result of this function.
See also
Status& Communication::GetError ();

Implements lldb_private::Connection.

Definition at line 58 of file ConnectionConPTYWindows.cpp.

References lldb::eConnectionStatusSuccess, and m_pty.

◆ Read()

size_t ConnectionConPTY::Read ( void * dst,
size_t dst_len,
const Timeout< std::micro > & timeout,
lldb::ConnectionStatus & status,
Status * error_ptr )
overridevirtual

Read from the ConPTY's pipe.

Before reading, check if the ConPTY is closing and wait for it to close before reading. This prevents race conditions when closing the ConPTY during a read. After reading, remove the ConPTY VT init sequence if present.

Implements lldb_private::Connection.

Definition at line 63 of file ConnectionConPTYWindows.cpp.

References m_pty, m_pty_vt_sequence_was_stripped, lldb_private::ConnectionGenericFile::Read(), and StripConPTYInitSequences().

◆ Write()

size_t ConnectionConPTY::Write ( const void * dst,
size_t dst_len,
lldb::ConnectionStatus & status,
Status * error_ptr )
overridevirtual

The actual write function that attempts to write to the communications protocol.

Subclasses must override this function.

Parameters
[in]dstA destination buffer that must be at least dst_len bytes long.
[in]dst_lenThe number of bytes to attempt to write, and also the number of bytes are currently available in dst.
[out]error_ptrA pointer to an error object that should be given an appropriate error value if this method returns zero. This value can be NULL if the error value should be ignored.
Returns
The number of bytes actually Written.

Implements lldb_private::Connection.

Definition at line 83 of file ConnectionConPTYWindows.cpp.

Member Data Documentation

◆ m_pty

std::shared_ptr<PseudoConsole> lldb_private::ConnectionConPTY::m_pty
protected

Definition at line 45 of file ConnectionConPTYWindows.h.

Referenced by Connect(), ConnectionConPTY(), Disconnect(), and Read().

◆ m_pty_vt_sequence_was_stripped

bool lldb_private::ConnectionConPTY::m_pty_vt_sequence_was_stripped = false
protected

Definition at line 46 of file ConnectionConPTYWindows.h.

Referenced by Read().


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