LLDB  mainline
Public Member Functions | Protected Types | Protected Attributes | Private Member Functions | Private Attributes | List of all members
lldb_private::ConnectionGenericFile Class Reference

#include <ConnectionGenericFileWindows.h>

Inheritance diagram for lldb_private::ConnectionGenericFile:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::ConnectionGenericFile:
Collaboration graph
[legend]

Public Member Functions

 ConnectionGenericFile ()
 
 ConnectionGenericFile (lldb::file_t file, bool owns_file)
 
 ~ConnectionGenericFile () override
 
bool IsConnected () const override
 Check if the connection is valid. More...
 
lldb::ConnectionStatus Connect (llvm::StringRef s, Status *error_ptr) override
 Connect using the connect string url. More...
 
lldb::ConnectionStatus Disconnect (Status *error_ptr) override
 Disconnect the communications connection if one is currently connected. More...
 
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. More...
 
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. More...
 
std::string GetURI () override
 Returns a URI that describes this connection object. More...
 
bool InterruptRead () override
 Interrupts an ongoing Read() operation. More...
 
- Public Member Functions inherited from lldb_private::Connection
 Connection ()=default
 Default constructor. More...
 
virtual ~Connection ()
 Virtual destructor since this class gets subclassed and handed to a Communication object. More...
 
virtual lldb::IOObjectSP GetReadObject ()
 Returns the underlying IOObject used by the Connection. More...
 

Protected Types

enum  { kBytesAvailableEvent, kInterruptEvent }
 

Protected Attributes

OVERLAPPED m_overlapped
 
HANDLE m_file
 
HANDLE m_event_handles [2]
 
bool m_owns_file
 
LARGE_INTEGER m_file_position
 

Private Member Functions

void InitializeEventHandles ()
 
void IncrementFilePointer (DWORD amount)
 
 ConnectionGenericFile (const ConnectionGenericFile &)=delete
 
const ConnectionGenericFileoperator= (const ConnectionGenericFile &)=delete
 

Private Attributes

std::string m_uri
 

Detailed Description

Definition at line 20 of file ConnectionGenericFileWindows.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
kBytesAvailableEvent 
kInterruptEvent 

Definition at line 51 of file ConnectionGenericFileWindows.h.

Constructor & Destructor Documentation

◆ ConnectionGenericFile() [1/3]

ConnectionGenericFile::ConnectionGenericFile ( )

◆ ConnectionGenericFile() [2/3]

ConnectionGenericFile::ConnectionGenericFile ( lldb::file_t  file,
bool  owns_file 
)

◆ ~ConnectionGenericFile()

ConnectionGenericFile::~ConnectionGenericFile ( )
override

◆ ConnectionGenericFile() [3/3]

lldb_private::ConnectionGenericFile::ConnectionGenericFile ( const ConnectionGenericFile )
privatedelete

Member Function Documentation

◆ Connect()

lldb::ConnectionStatus ConnectionGenericFile::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 91 of file ConnectionGenericFileWindows.cpp.

References Disconnect(), lldb::eConnectionStatusError, lldb::eConnectionStatusSuccess, lldb::eErrorTypeGeneric, lldb::eErrorTypeWin32, lldb_private::GetLogIfAnyCategoriesSet(), IsConnected(), LIBLLDB_LOG_CONNECTION, LLDB_LOGF, m_file, m_owns_file, m_uri, lldb_private::Status::SetError(), and lldb_private::Status::SetErrorStringWithFormat().

◆ Disconnect()

lldb::ConnectionStatus ConnectionGenericFile::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 134 of file ConnectionGenericFileWindows.cpp.

References lldb::eConnectionStatusSuccess, lldb_private::GetLogIfAnyCategoriesSet(), IsConnected(), LIBLLDB_LOG_CONNECTION, LLDB_LOGF, m_file, m_file_position, m_overlapped, m_owns_file, and m_uri.

Referenced by Connect().

◆ GetURI()

std::string ConnectionGenericFile::GetURI ( )
overridevirtual

Returns a URI that describes this connection object.

Subclasses may override this function.

Returns
Returns URI or an empty string if disconnecteds

Implements lldb_private::Connection.

Definition at line 305 of file ConnectionGenericFileWindows.cpp.

References m_uri.

◆ IncrementFilePointer()

void ConnectionGenericFile::IncrementFilePointer ( DWORD  amount)
private

Definition at line 311 of file ConnectionGenericFileWindows.cpp.

References m_overlapped.

Referenced by Read(), and Write().

◆ InitializeEventHandles()

void ConnectionGenericFile::InitializeEventHandles ( )
private

◆ InterruptRead()

bool ConnectionGenericFile::InterruptRead ( )
overridevirtual

Interrupts an ongoing Read() operation.

If there is an ongoing read operation in another thread, this operation return with status == eConnectionStatusInterrupted. Note that if there data waiting to be read and an interrupt request is issued, the Read() function will return the data immediately without processing the interrupt request (which will remain queued for the next Read() operation).

Returns
Returns true is the interrupt request was successful.

Implements lldb_private::Connection.

Definition at line 307 of file ConnectionGenericFileWindows.cpp.

References kInterruptEvent, and m_event_handles.

◆ IsConnected()

bool ConnectionGenericFile::IsConnected ( ) const
overridevirtual

Check if the connection is valid.

Returns
True if this object is currently connected, false otherwise.

Implements lldb_private::Connection.

Definition at line 87 of file ConnectionGenericFileWindows.cpp.

References m_file.

Referenced by Connect(), Disconnect(), Read(), Write(), and ~ConnectionGenericFile().

◆ operator=()

const ConnectionGenericFile& lldb_private::ConnectionGenericFile::operator= ( const ConnectionGenericFile )
privatedelete

◆ Read()

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

The read function that attempts to read from the connection.

Parameters
[in]dstA destination buffer that must be at least dst_len bytes long.
[in]dst_lenThe number of bytes to attempt to read, and also the max number of bytes that can be placed into dst.
[in]timeoutThe number of microseconds to wait for the data.
[out]statusOn return, indicates whether the call was successful or terminated due to some error condition.
[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 read.
See also
size_t Communication::Read (void *, size_t, uint32_t);

Implements lldb_private::Connection.

Definition at line 162 of file ConnectionGenericFileWindows.cpp.

References lldb_private::Status::Clear(), lldb::eConnectionStatusEndOfFile, lldb::eConnectionStatusError, lldb::eConnectionStatusInterrupted, lldb::eConnectionStatusNoConnection, lldb::eConnectionStatusSuccess, lldb::eConnectionStatusTimedOut, lldb_private::GetLogIfAnyCategoriesSet(), IncrementFilePointer(), IsConnected(), kBytesAvailableEvent, kInterruptEvent, LIBLLDB_LOG_CONNECTION, LLDB_LOGF, m_event_handles, m_file, and m_overlapped.

◆ Write()

size_t ConnectionGenericFile::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 257 of file ConnectionGenericFileWindows.cpp.

References lldb_private::Status::Clear(), lldb::eConnectionStatusError, lldb::eConnectionStatusNoConnection, lldb::eConnectionStatusSuccess, lldb_private::GetLogIfAnyCategoriesSet(), IncrementFilePointer(), IsConnected(), LIBLLDB_LOG_CONNECTION, LLDB_LOGF, m_file, and m_overlapped.

Member Data Documentation

◆ m_event_handles

HANDLE lldb_private::ConnectionGenericFile::m_event_handles[2]
protected

◆ m_file

HANDLE lldb_private::ConnectionGenericFile::m_file
protected

◆ m_file_position

LARGE_INTEGER lldb_private::ConnectionGenericFile::m_file_position
protected

Definition at line 49 of file ConnectionGenericFileWindows.h.

Referenced by ConnectionGenericFile(), and Disconnect().

◆ m_overlapped

OVERLAPPED lldb_private::ConnectionGenericFile::m_overlapped
protected

◆ m_owns_file

bool lldb_private::ConnectionGenericFile::m_owns_file
protected

Definition at line 48 of file ConnectionGenericFileWindows.h.

Referenced by Connect(), Disconnect(), and ~ConnectionGenericFile().

◆ m_uri

std::string lldb_private::ConnectionGenericFile::m_uri
private

Definition at line 57 of file ConnectionGenericFileWindows.h.

Referenced by Connect(), Disconnect(), and GetURI().


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