23 m_opaque_owned(true) {
36 return this->
operator bool();
38SBCommunication::operator bool()
const {
41 return m_opaque !=
nullptr;
80 std::make_unique<ConnectionFileDescriptor>(fd, owns_fd));
108 size_t bytes_read = 0;
111 : std::chrono::microseconds(timeout_usec);
113 bytes_read =
m_opaque->
Read(dst, dst_len, timeout, status,
nullptr);
124 size_t bytes_written = 0;
126 bytes_written =
m_opaque->
Write(src, src_len, status,
nullptr);
130 return bytes_written;
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
static void ReadThreadBytesReceived(void *baton, const void *src, size_t src_len)
lldb_private::ThreadedCommunication * m_opaque
static const char * GetBroadcasterClass()
bool ReadThreadIsRunning()
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status)
size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status)
lldb::ConnectionStatus Disconnect()
lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd)
lldb::ConnectionStatus Connect(const char *url)
void SetCloseOnEOF(bool b)
lldb::SBBroadcaster GetBroadcaster()
bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback, void *callback_baton)
bool GetCloseOnEOF() const
lldb::ConnectionStatus Connect(const char *url, Status *error_ptr)
Connect using the current connection by passing url to its connect function.
bool IsConnected() const
Check if the connection is valid.
void SetCloseOnEOF(bool b)
bool HasConnection() const
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Status *error_ptr)
The actual write function that attempts to write to the communications protocol.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
static std::unique_ptr< Connection > CreateDefaultConnection(llvm::StringRef url)
"lldb/Core/ThreadedCommunication.h" Variation of Communication that supports threaded reads.
size_t Read(void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr) override
Read bytes from the current connection.
void SetConnection(std::unique_ptr< Connection > connection) override
Sets the connection that it to be used by this class.
virtual bool StopReadThread(Status *error_ptr=nullptr)
Stops the read thread by cancelling it.
lldb::ConnectionStatus Disconnect(Status *error_ptr=nullptr) override
Disconnect the communications connection if one is currently connected.
virtual bool StartReadThread(Status *error_ptr=nullptr)
Starts a read thread whose sole purpose it to read bytes from the current connection.
static llvm::StringRef GetStaticBroadcasterClass()
bool ReadThreadIsRunning()
Checks if there is a currently running read thread.
void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback, void *callback_baton)
A class that represents a running process on the host machine.
ConnectionStatus
Connection Status Types.
@ eConnectionStatusSuccess
Success.
@ eConnectionStatusLostConnection
Lost connection while connected to a valid connection.
@ eConnectionStatusNoConnection
No connection.