LLDB  mainline
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
lldb_private::SerialPort Class Reference

#include <File.h>

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

Classes

struct  Options
 

Public Member Functions

bool IsValid () const override
 IsValid. More...
 
Status Close () override
 Flush any buffers and release any resources owned by the file. More...
 
virtual bool isA (const void *classID) const override
 
- Public Member Functions inherited from lldb_private::NativeFile
 NativeFile ()
 
 NativeFile (FILE *fh, bool transfer_ownership)
 
 NativeFile (int fd, OpenOptions options, bool transfer_ownership)
 
 ~NativeFile () override
 
Status Read (void *buf, size_t &num_bytes) override
 Read bytes from a file from the current file position into buf. More...
 
Status Write (const void *buf, size_t &num_bytes) override
 Write bytes from buf to a file at the current file position. More...
 
WaitableHandle GetWaitableHandle () override
 Get a handle that can be used for OS polling interfaces, such as WaitForMultipleObjects, select, or epoll. More...
 
Status GetFileSpec (FileSpec &file_spec) const override
 Get the file specification for this file, if possible. More...
 
int GetDescriptor () const override
 Get underlying OS file descriptor for this file, or kInvalidDescriptor. More...
 
FILE * GetStream () override
 Get the underlying libc stream for this file, or NULL. More...
 
off_t SeekFromStart (off_t offset, Status *error_ptr=nullptr) override
 Seek to an offset relative to the beginning of the file. More...
 
off_t SeekFromCurrent (off_t offset, Status *error_ptr=nullptr) override
 Seek to an offset relative to the current file position. More...
 
off_t SeekFromEnd (off_t offset, Status *error_ptr=nullptr) override
 Seek to an offset relative to the end of the file. More...
 
Status Read (void *dst, size_t &num_bytes, off_t &offset) override
 Read bytes from a file from the specified file offset. More...
 
Status Write (const void *src, size_t &num_bytes, off_t &offset) override
 Write bytes to a file at the specified file offset. More...
 
Status Flush () override
 Flush the current stream. More...
 
Status Sync () override
 Sync to disk. More...
 
size_t PrintfVarArg (const char *format, va_list args) override
 Output printf formatted output to the stream. More...
 
llvm::Expected< OpenOptionsGetOptions () const override
 Return the OpenOptions for this file. More...
 
- Public Member Functions inherited from lldb_private::File
 File ()
 
size_t Printf (const char *format,...) __attribute__((format(printf
 Output printf formatted output to the stream. More...
 
llvm::Expected< const char * > GetOpenMode () const
 
uint32_t GetPermissions (Status &error) const
 Get the permissions for a this file. More...
 
bool GetIsInteractive ()
 Return true if this file is interactive. More...
 
bool GetIsRealTerminal ()
 Return true if this file from a real terminal. More...
 
bool GetIsTerminalWithColors ()
 Return true if this file is a terminal which supports colors. More...
 
 operator bool () const
 
bool operator! () const
 
- Public Member Functions inherited from lldb_private::IOObject
 IOObject (FDType type)
 
virtual ~IOObject ()
 
FDType GetFdType () const
 

Static Public Member Functions

static llvm::Expected< OptionsOptionsFromURL (llvm::StringRef urlqs)
 
static llvm::Expected< std::unique_ptr< SerialPort > > Create (int fd, OpenOptions options, Options serial_options, bool transfer_ownership)
 
static bool classof (const File *file)
 
- Static Public Member Functions inherited from lldb_private::NativeFile
static bool classof (const File *file)
 
- Static Public Member Functions inherited from lldb_private::File
static mode_t ConvertOpenOptionsForPOSIXOpen (OpenOptions open_options)
 
static llvm::Expected< OpenOptionsGetOptionsFromMode (llvm::StringRef mode)
 
static bool DescriptorIsValid (int descriptor)
 
static llvm::Expected< const char * > GetStreamOpenModeFromOptions (OpenOptions options)
 
static bool classof (const File *file)
 

Static Public Attributes

static char ID = 0
 
- Static Public Attributes inherited from lldb_private::NativeFile
static char ID = 0
 
- Static Public Attributes inherited from lldb_private::File
static int kInvalidDescriptor = -1
 
static FILE * kInvalidStream = nullptr
 
static char ID = 0
 
- Static Public Attributes inherited from lldb_private::IOObject
static const WaitableHandle kInvalidHandleValue = -1
 

Private Member Functions

 SerialPort (int fd, OpenOptions options, Options serial_options, bool transfer_ownership)
 
 SerialPort (const SerialPort &)=delete
 
const SerialPortoperator= (const SerialPort &)=delete
 

Private Attributes

TerminalState m_state
 

Additional Inherited Members

- Public Types inherited from lldb_private::File
enum  OpenOptions : uint32_t {
  eOpenOptionReadOnly = 0x0, eOpenOptionWriteOnly = 0x1, eOpenOptionReadWrite = 0x2, eOpenOptionAppend,
  eOpenOptionCanCreate = 0x200, eOpenOptionTruncate = 0x400, eOpenOptionCanCreateNewOnly, eOpenOptionNonBlocking = (1u << 28),
  eOpenOptionDontFollowSymlinks = (1u << 29), eOpenOptionCloseOnExec, eOpenOptionInvalid = (1u << 31)
}
 
- Public Types inherited from lldb_private::IOObject
enum  FDType { eFDTypeFile, eFDTypeSocket }
 
typedef int WaitableHandle
 
- Protected Member Functions inherited from lldb_private::NativeFile
bool DescriptorIsValid () const
 
bool StreamIsValid () const
 
- Protected Member Functions inherited from lldb_private::File
void CalculateInteractiveAndTerminal ()
 
- Protected Attributes inherited from lldb_private::NativeFile
int m_descriptor
 
bool m_own_descriptor = false
 
FILE * m_stream
 
OpenOptions m_options {}
 
bool m_own_stream = false
 
std::mutex offset_access_mutex
 
- Protected Attributes inherited from lldb_private::File
LazyBool m_is_interactive = eLazyBoolCalculate
 
LazyBool m_is_real_terminal = eLazyBoolCalculate
 
LazyBool m_supports_colors = eLazyBoolCalculate
 
- Protected Attributes inherited from lldb_private::IOObject
FDType m_fd_type
 

Detailed Description

Definition at line 437 of file File.h.

Constructor & Destructor Documentation

◆ SerialPort() [1/2]

SerialPort::SerialPort ( int  fd,
OpenOptions  options,
SerialPort::Options  serial_options,
bool  transfer_ownership 
)
private

Definition at line 863 of file File.cpp.

◆ SerialPort() [2/2]

lldb_private::SerialPort::SerialPort ( const SerialPort )
privatedelete

Member Function Documentation

◆ classof()

static bool lldb_private::SerialPort::classof ( const File file)
inlinestatic

Definition at line 464 of file File.h.

References ID, and lldb_private::File::isA().

◆ Close()

Status SerialPort::Close ( )
overridevirtual

Flush any buffers and release any resources owned by the file.

After Close() the file will be invalid.

Returns
success or an error.

Reimplemented from lldb_private::NativeFile.

Definition at line 868 of file File.cpp.

References lldb_private::NativeFile::Close(), and m_state.

◆ Create()

llvm::Expected< std::unique_ptr< SerialPort > > SerialPort::Create ( int  fd,
OpenOptions  options,
Options  serial_options,
bool  transfer_ownership 
)
static

◆ isA()

virtual bool lldb_private::SerialPort::isA ( const void *  classID) const
inlineoverridevirtual

Reimplemented from lldb_private::NativeFile.

Definition at line 461 of file File.h.

References ID, and lldb_private::File::isA().

◆ IsValid()

bool lldb_private::SerialPort::IsValid ( ) const
inlineoverridevirtual

IsValid.

Returns
true iff the file is valid.

Reimplemented from lldb_private::NativeFile.

Definition at line 454 of file File.h.

References lldb_private::eLazyBoolYes, lldb_private::NativeFile::IsValid(), and lldb_private::File::m_is_interactive.

◆ operator=()

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

◆ OptionsFromURL()

llvm::Expected< SerialPort::Options > SerialPort::OptionsFromURL ( llvm::StringRef  urlqs)
static

Member Data Documentation

◆ ID

char SerialPort::ID = 0
static

Definition at line 460 of file File.h.

Referenced by classof(), and isA().

◆ m_state

TerminalState lldb_private::SerialPort::m_state
private

Definition at line 473 of file File.h.

Referenced by Close().


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