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]

Classes

struct  Options
 

Public Member Functions

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

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 DescriptorIsValidUnlocked () const
 
bool StreamIsValidUnlocked () const
 
ValueGuard DescriptorIsValid () const
 
ValueGuard 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
 
std::mutex m_descriptor_mutex
 
FILE * m_stream
 
std::mutex m_stream_mutex
 
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 458 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 895 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 485 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 900 of file File.cpp.

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

◆ Create()

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

◆ isA()

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

Reimplemented from lldb_private::NativeFile.

Definition at line 482 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 475 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 481 of file File.h.

Referenced by classof(), and isA().

◆ m_state

TerminalState lldb_private::SerialPort::m_state
private

Definition at line 494 of file File.h.

Referenced by Close().


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