LLDB mainline
|
A posix-based implementation of Pipe, a class that abtracts unix style pipes. More...
#include "lldb/Host/posix/PipePosix.h"
Public Member Functions | |
PipePosix () | |
PipePosix (lldb::pipe_t read, lldb::pipe_t write) | |
PipePosix (const PipePosix &)=delete | |
PipePosix (PipePosix &&pipe_posix) | |
PipePosix & | operator= (const PipePosix &)=delete |
PipePosix & | operator= (PipePosix &&pipe_posix) |
~PipePosix () override | |
Status | CreateNew () override |
Status | CreateNew (llvm::StringRef name) override |
Status | CreateWithUniqueName (llvm::StringRef prefix, llvm::SmallVectorImpl< char > &name) override |
Status | OpenAsReader (llvm::StringRef name) override |
llvm::Error | OpenAsWriter (llvm::StringRef name, const Timeout< std::micro > &timeout) override |
bool | CanRead () const override |
bool | CanWrite () const override |
lldb::pipe_t | GetReadPipe () const override |
lldb::pipe_t | GetWritePipe () const override |
int | GetReadFileDescriptor () const override |
int | GetWriteFileDescriptor () const override |
int | ReleaseReadFileDescriptor () override |
int | ReleaseWriteFileDescriptor () override |
void | CloseReadFileDescriptor () override |
void | CloseWriteFileDescriptor () override |
void | Close () override |
Status | Delete (llvm::StringRef name) override |
llvm::Expected< size_t > | Write (const void *buf, size_t size, const Timeout< std::micro > &timeout=std::nullopt) override |
llvm::Expected< size_t > | Read (void *buf, size_t size, const Timeout< std::micro > &timeout=std::nullopt) override |
Public Member Functions inherited from lldb_private::PipeBase | |
virtual | ~PipeBase () |
Static Public Attributes | |
static int | kInvalidDescriptor = -1 |
Private Member Functions | |
bool | CanReadUnlocked () const |
bool | CanWriteUnlocked () const |
int | GetReadFileDescriptorUnlocked () const |
int | GetWriteFileDescriptorUnlocked () const |
int | ReleaseReadFileDescriptorUnlocked () |
int | ReleaseWriteFileDescriptorUnlocked () |
void | CloseReadFileDescriptorUnlocked () |
void | CloseWriteFileDescriptorUnlocked () |
void | CloseUnlocked () |
Private Attributes | |
int | m_fds [2] |
std::mutex | m_read_mutex |
Mutexes for m_fds;. | |
std::mutex | m_write_mutex |
A posix-based implementation of Pipe, a class that abtracts unix style pipes.
A class that abstracts the LLDB core from host pipe functionality.
Definition at line 22 of file PipePosix.h.
PipePosix::PipePosix | ( | ) |
Definition at line 58 of file PipePosix.cpp.
References kInvalidDescriptor, m_fds, and PipePosix().
Referenced by operator=(), operator=(), PipePosix(), PipePosix(), and PipePosix().
PipePosix::PipePosix | ( | lldb::pipe_t | read, |
lldb::pipe_t | write ) |
Definition at line 61 of file PipePosix.cpp.
References m_fds.
|
delete |
References PipePosix().
PipePosix::PipePosix | ( | PipePosix && | pipe_posix | ) |
Definition at line 64 of file PipePosix.cpp.
References m_fds, PipePosix(), ReleaseReadFileDescriptor(), and ReleaseWriteFileDescriptor().
|
override |
Definition at line 80 of file PipePosix.cpp.
References Close().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 257 of file PipePosix.cpp.
References CanReadUnlocked(), and m_read_mutex.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
private |
Definition at line 262 of file PipePosix.cpp.
References kInvalidDescriptor, m_fds, and READ.
Referenced by CanRead(), CloseReadFileDescriptorUnlocked(), CreateNew(), CreateNew(), OpenAsReader(), OpenAsWriter(), and Read().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 266 of file PipePosix.cpp.
References CanWriteUnlocked(), and m_write_mutex.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
private |
Definition at line 271 of file PipePosix.cpp.
References kInvalidDescriptor, m_fds, and WRITE.
Referenced by CanWrite(), CloseWriteFileDescriptorUnlocked(), CreateNew(), CreateNew(), OpenAsReader(), OpenAsWriter(), and Write().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 243 of file PipePosix.cpp.
References CloseUnlocked(), m_read_mutex, and m_write_mutex.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess(), and ~PipePosix().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 275 of file PipePosix.cpp.
References CloseReadFileDescriptorUnlocked(), and m_read_mutex.
Referenced by lldb_private::ProcessLauncherPosixFork::LaunchProcess().
|
private |
Definition at line 279 of file PipePosix.cpp.
References CanReadUnlocked(), kInvalidDescriptor, m_fds, and READ.
Referenced by CloseReadFileDescriptor(), and CloseUnlocked().
|
private |
Definition at line 248 of file PipePosix.cpp.
References CloseReadFileDescriptorUnlocked(), and CloseWriteFileDescriptorUnlocked().
Referenced by Close(), and CreateNew().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 286 of file PipePosix.cpp.
References CloseWriteFileDescriptorUnlocked(), and m_write_mutex.
Referenced by lldb_private::ProcessLauncherPosixFork::LaunchProcess(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
private |
Definition at line 291 of file PipePosix.cpp.
References CanWriteUnlocked(), kInvalidDescriptor, m_fds, and WRITE.
Referenced by CloseUnlocked(), and CloseWriteFileDescriptor().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 82 of file PipePosix.cpp.
References CanReadUnlocked(), CanWriteUnlocked(), CloseUnlocked(), lldb::eErrorTypePOSIX, error(), lldb_private::Status::FromErrno(), kInvalidDescriptor, m_fds, m_read_mutex, m_write_mutex, READ, lldb_private::Status, and WRITE.
Referenced by CreateWithUniqueName(), lldb_private::ProcessLauncherPosixFork::LaunchProcess(), lldb_private::ScriptInterpreterIORedirect::ScriptInterpreterIORedirect(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 110 of file PipePosix.cpp.
References CanReadUnlocked(), CanWriteUnlocked(), error(), lldb_private::Status::FromErrno(), lldb_private::Status::FromErrorString(), m_read_mutex, and m_write_mutex.
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 121 of file PipePosix.cpp.
References lldb_private::FileSpec::AppendPathComponent(), CreateNew(), error(), and lldb_private::FileSpec::GetPath().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 253 of file PipePosix.cpp.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 203 of file PipePosix.cpp.
References GetReadFileDescriptorUnlocked(), and m_read_mutex.
Referenced by GetReadPipe(), and lldb_private::ProcessLauncherPosixFork::LaunchProcess().
|
private |
Definition at line 208 of file PipePosix.cpp.
Referenced by GetReadFileDescriptor(), and Read().
|
inlineoverridevirtual |
Implements lldb_private::PipeBase.
Definition at line 46 of file PipePosix.h.
References GetReadFileDescriptor().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 212 of file PipePosix.cpp.
References GetWriteFileDescriptorUnlocked(), and m_write_mutex.
Referenced by GetWritePipe().
|
private |
Definition at line 217 of file PipePosix.cpp.
Referenced by GetWriteFileDescriptor(), and Write().
|
inlineoverridevirtual |
Implements lldb_private::PipeBase.
Definition at line 49 of file PipePosix.h.
References GetWriteFileDescriptor().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 145 of file PipePosix.cpp.
References CanReadUnlocked(), CanWriteUnlocked(), error(), lldb_private::Status::FromErrno(), lldb_private::Status::FromErrorString(), lldb_private::FileSystem::Instance(), m_fds, m_read_mutex, m_write_mutex, O_NONBLOCK, lldb_private::FileSystem::Open(), and READ.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 163 of file PipePosix.cpp.
References CanReadUnlocked(), CanWriteUnlocked(), m_fds, m_write_mutex, Now(), O_NONBLOCK, OPEN_WRITER_SLEEP_TIMEOUT_MSECS, and WRITE.
References PipePosix().
Definition at line 69 of file PipePosix.cpp.
References m_fds, m_read_mutex, m_write_mutex, PipePosix(), READ, and WRITE.
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 298 of file PipePosix.cpp.
References CanReadUnlocked(), error(), SelectHelper::FDSetRead(), GetReadFileDescriptorUnlocked(), m_read_mutex, SelectHelper::Select(), SelectHelper::SetTimeout(), and lldb_private::Status::takeError().
Referenced by lldb_private::SharedSocket::GetNativeSocket(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 221 of file PipePosix.cpp.
References m_read_mutex, and ReleaseReadFileDescriptorUnlocked().
Referenced by PipePosix(), and lldb_private::ScriptInterpreterIORedirect::ScriptInterpreterIORedirect().
|
private |
Definition at line 226 of file PipePosix.cpp.
References kInvalidDescriptor, m_fds, and READ.
Referenced by ReleaseReadFileDescriptor().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 232 of file PipePosix.cpp.
References m_write_mutex, and ReleaseWriteFileDescriptorUnlocked().
Referenced by lldb_private::ProcessLauncherPosixFork::LaunchProcess(), PipePosix(), and lldb_private::ScriptInterpreterIORedirect::ScriptInterpreterIORedirect().
|
private |
Definition at line 237 of file PipePosix.cpp.
References kInvalidDescriptor, m_fds, and WRITE.
Referenced by ReleaseWriteFileDescriptor().
|
overridevirtual |
Implements lldb_private::PipeBase.
Definition at line 323 of file PipePosix.cpp.
References CanWriteUnlocked(), error(), SelectHelper::FDSetWrite(), GetWriteFileDescriptorUnlocked(), m_write_mutex, SelectHelper::Select(), SelectHelper::SetTimeout(), and lldb_private::Status::takeError().
|
static |
Definition at line 24 of file PipePosix.h.
Referenced by CanReadUnlocked(), CanWriteUnlocked(), CloseReadFileDescriptorUnlocked(), CloseWriteFileDescriptorUnlocked(), CreateNew(), PipePosix(), ReleaseReadFileDescriptorUnlocked(), and ReleaseWriteFileDescriptorUnlocked().
|
private |
Definition at line 85 of file PipePosix.h.
Referenced by CanReadUnlocked(), CanWriteUnlocked(), CloseReadFileDescriptorUnlocked(), CloseWriteFileDescriptorUnlocked(), CreateNew(), GetReadFileDescriptorUnlocked(), GetWriteFileDescriptorUnlocked(), OpenAsReader(), OpenAsWriter(), operator=(), PipePosix(), PipePosix(), PipePosix(), ReleaseReadFileDescriptorUnlocked(), and ReleaseWriteFileDescriptorUnlocked().
|
mutableprivate |
Mutexes for m_fds;.
Definition at line 88 of file PipePosix.h.
Referenced by CanRead(), Close(), CloseReadFileDescriptor(), CreateNew(), CreateNew(), GetReadFileDescriptor(), OpenAsReader(), operator=(), Read(), and ReleaseReadFileDescriptor().
|
mutableprivate |
Definition at line 89 of file PipePosix.h.
Referenced by CanWrite(), Close(), CloseWriteFileDescriptor(), CreateNew(), CreateNew(), GetWriteFileDescriptor(), OpenAsReader(), OpenAsWriter(), operator=(), ReleaseWriteFileDescriptor(), and Write().