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

#include <GDBRemoteCommunicationServerPlatform.h>

Inheritance diagram for lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform:
Collaboration graph
[legend]

Classes

class  PortMap
 

Public Member Functions

 GDBRemoteCommunicationServerPlatform (const Socket::SocketProtocol socket_protocol, const char *socket_scheme)
 
 ~GDBRemoteCommunicationServerPlatform () override
 
Status LaunchProcess () override
 Launch a process with the current launch settings.
 
void SetPortMap (PortMap &&port_map)
 
void SetPortOffset (uint16_t port_offset)
 
void SetInferiorArguments (const lldb_private::Args &args)
 
Status LaunchGDBServer (const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid, std::optional< uint16_t > &port, std::string &socket_name)
 
void SetPendingGdbServer (lldb::pid_t pid, uint16_t port, const std::string &socket_name)
 
- Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon
 GDBRemoteCommunicationServerCommon ()
 
 ~GDBRemoteCommunicationServerCommon () override
 
- Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServer
 GDBRemoteCommunicationServer ()
 
 ~GDBRemoteCommunicationServer () override
 
void RegisterPacketHandler (StringExtractorGDBRemote::ServerPacketType packet_type, PacketHandler handler)
 
PacketResult GetPacketAndSendResponse (Timeout< std::micro > timeout, Status &error, bool &interrupt, bool &quit)
 
- Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
 GDBRemoteCommunication ()
 
 ~GDBRemoteCommunication () override
 
PacketResult GetAck ()
 
size_t SendAck ()
 
size_t SendNack ()
 
char CalculcateChecksum (llvm::StringRef payload)
 
PacketType CheckForPacket (const uint8_t *src, size_t src_len, StringExtractorGDBRemote &packet)
 
bool GetSendAcks ()
 
std::chrono::seconds SetPacketTimeout (std::chrono::seconds packet_timeout)
 
std::chrono::seconds GetPacketTimeout () const
 
Status StartDebugserverProcess (const char *url, Platform *platform, ProcessLaunchInfo &launch_info, uint16_t *port, const Args *inferior_args, int pass_comm_fd)
 
void DumpHistory (Stream &strm)
 
void SetPacketRecorder (repro::PacketRecorder *recorder)
 
- Public Member Functions inherited from lldb_private::Communication
 Communication ()
 Construct the Communication object.
 
virtual ~Communication ()
 Destructor.
 
virtual void Clear ()
 
lldb::ConnectionStatus Connect (const char *url, Status *error_ptr)
 Connect using the current connection by passing url to its connect function.
 
virtual lldb::ConnectionStatus Disconnect (Status *error_ptr=nullptr)
 Disconnect the communications connection if one is currently connected.
 
bool IsConnected () const
 Check if the connection is valid.
 
bool HasConnection () const
 
lldb_private::ConnectionGetConnection ()
 
virtual size_t Read (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr)
 Read bytes from the current connection.
 
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.
 
size_t WriteAll (const void *src, size_t src_len, lldb::ConnectionStatus &status, Status *error_ptr)
 Repeatedly attempt writing until either src_len bytes are written or a permanent failure occurs.
 
virtual void SetConnection (std::unique_ptr< Connection > connection)
 Sets the connection that it to be used by this class.
 
bool GetCloseOnEOF () const
 
void SetCloseOnEOF (bool b)
 

Protected Member Functions

PacketResult Handle_qLaunchGDBServer (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qQueryGDBServer (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qKillSpawnedProcess (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qPathComplete (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qProcessInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qGetWorkingDir (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QSetWorkingDir (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qC (StringExtractorGDBRemote &packet)
 
PacketResult Handle_jSignalsInfo (StringExtractorGDBRemote &packet)
 
- Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon
PacketResult Handle_A (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qHostInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qProcessInfoPID (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qfProcessInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qsProcessInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qUserName (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qGroupName (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qSpeedTest (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Open (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Close (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_pRead (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_pWrite (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Size (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Mode (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Exists (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_symlink (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_unlink (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_FStat (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_Stat (StringExtractorGDBRemote &packet)
 
PacketResult Handle_vFile_MD5 (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qEcho (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qModuleInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_jModulesInfo (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qPlatform_shell (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qPlatform_mkdir (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qPlatform_chmod (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qSupported (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QSetDetachOnError (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QStartNoAckMode (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QSetSTDIN (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QSetSTDOUT (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QSetSTDERR (StringExtractorGDBRemote &packet)
 
PacketResult Handle_qLaunchSuccess (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QEnvironment (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QEnvironmentHexEncoded (StringExtractorGDBRemote &packet)
 
PacketResult Handle_QLaunchArch (StringExtractorGDBRemote &packet)
 
template<typename T >
void RegisterMemberFunctionHandler (StringExtractorGDBRemote::ServerPacketType packet_type, PacketResult(T::*handler)(StringExtractorGDBRemote &packet))
 
virtual Status LaunchProcess ()=0
 Launch a process with the current launch settings.
 
virtual FileSpec FindModuleFile (const std::string &module_path, const ArchSpec &arch)
 
virtual std::vector< std::string > HandleFeatures (llvm::ArrayRef< llvm::StringRef > client_features)
 
- Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServer
PacketResult Handle_QErrorStringEnable (StringExtractorGDBRemote &packet)
 
PacketResult SendErrorResponse (const Status &error)
 
PacketResult SendErrorResponse (llvm::Error error)
 
PacketResult SendUnimplementedResponse (const char *packet)
 
PacketResult SendErrorResponse (uint8_t error)
 
PacketResult SendIllFormedResponse (const StringExtractorGDBRemote &packet, const char *error_message)
 
PacketResult SendOKResponse ()
 
PacketResult SendJSONResponse (const llvm::json::Value &value)
 Serialize and send a JSON object response.
 
PacketResult SendJSONResponse (llvm::Expected< llvm::json::Value > value)
 Serialize and send a JSON object response, or respond with an error if the input object is an llvm::Error.
 
- Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
PacketResult SendPacketNoLock (llvm::StringRef payload)
 
PacketResult SendNotificationPacketNoLock (llvm::StringRef notify_type, std::deque< std::string > &queue, llvm::StringRef payload)
 
PacketResult SendRawPacketNoLock (llvm::StringRef payload, bool skip_ack=false)
 
PacketResult ReadPacket (StringExtractorGDBRemote &response, Timeout< std::micro > timeout, bool sync_on_timeout)
 
PacketResult WaitForPacketNoLock (StringExtractorGDBRemote &response, Timeout< std::micro > timeout, bool sync_on_timeout)
 
bool CompressionIsEnabled ()
 
bool DecompressPacket ()
 
Status StartListenThread (const char *hostname="127.0.0.1", uint16_t port=0)
 
bool JoinListenThread ()
 
lldb::thread_result_t ListenThread ()
 
- Protected Member Functions inherited from lldb_private::Communication
size_t ReadFromConnection (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr)
 

Protected Attributes

const Socket::SocketProtocol m_socket_protocol
 
const std::string m_socket_scheme
 
std::recursive_mutex m_spawned_pids_mutex
 
std::set< lldb::pid_tm_spawned_pids
 
PortMap m_port_map
 
uint16_t m_port_offset
 
struct {
   lldb::pid_t   pid
 
   uint16_t   port
 
   std::string   socket_name
 
m_pending_gdb_server
 
- Protected Attributes inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon
ProcessLaunchInfo m_process_launch_info
 
Status m_process_launch_error
 
ProcessInstanceInfoList m_proc_infos
 
uint32_t m_proc_infos_index
 
- Protected Attributes inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServer
std::map< StringExtractorGDBRemote::ServerPacketType, PacketHandlerm_packet_handlers
 
bool m_exit_now
 
bool m_send_error_strings = false
 
- Protected Attributes inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
std::chrono::seconds m_packet_timeout
 
uint32_t m_echo_number
 
LazyBool m_supports_qEcho
 
GDBRemoteCommunicationHistory m_history
 
bool m_send_acks
 
bool m_is_platform
 
std::string m_bytes
 
std::recursive_mutex m_bytes_mutex
 
CompressionType m_compression_type
 
- Protected Attributes inherited from lldb_private::Communication
lldb::ConnectionSP m_connection_sp
 The connection that is current in use by this communications class.
 
std::mutex m_write_mutex
 Don't let multiple threads write at the same time...
 
bool m_close_on_eof
 

Private Member Functions

bool KillSpawnedProcess (lldb::pid_t pid)
 
void DebugserverProcessReaped (lldb::pid_t pid)
 
 GDBRemoteCommunicationServerPlatform (const GDBRemoteCommunicationServerPlatform &)=delete
 
const GDBRemoteCommunicationServerPlatformoperator= (const GDBRemoteCommunicationServerPlatform &)=delete
 

Static Private Member Functions

static const FileSpecGetDomainSocketDir ()
 
static FileSpec GetDomainSocketPath (const char *prefix)
 

Additional Inherited Members

- Public Types inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServer
using PacketHandler = std::function< PacketResult(StringExtractorGDBRemote &packet, Status &error, bool &interrupt, bool &quit)>
 
- Public Types inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
enum class  PacketType { Invalid = 0 , Standard , Notify }
 
enum class  PacketResult {
  Success = 0 , ErrorSendFailed , ErrorSendAck , ErrorReplyFailed ,
  ErrorReplyTimeout , ErrorReplyInvalid , ErrorReplyAck , ErrorDisconnected ,
  ErrorNoSequenceLock
}
 
- Static Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
static llvm::Error ConnectLocally (GDBRemoteCommunication &client, GDBRemoteCommunication &server)
 
static std::string ExpandRLE (std::string)
 Expand GDB run-length encoding.
 
- Static Public Member Functions inherited from lldb_private::Communication
static std::string ConnectionStatusAsString (lldb::ConnectionStatus status)
 
- Static Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon
static void CreateProcessInfoResponse (const ProcessInstanceInfo &proc_info, StreamString &response)
 
static void CreateProcessInfoResponse_DebugServerStyle (const ProcessInstanceInfo &proc_info, StreamString &response)
 

Detailed Description

Definition at line 25 of file GDBRemoteCommunicationServerPlatform.h.

Constructor & Destructor Documentation

◆ GDBRemoteCommunicationServerPlatform() [1/2]

GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform ( const Socket::SocketProtocol  socket_protocol,
const char *  socket_scheme 
)

◆ ~GDBRemoteCommunicationServerPlatform()

GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform ( )
overridedefault

◆ GDBRemoteCommunicationServerPlatform() [2/2]

lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform ( const GDBRemoteCommunicationServerPlatform )
privatedelete

Member Function Documentation

◆ DebugserverProcessReaped()

void GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped ( lldb::pid_t  pid)
private

◆ GetDomainSocketDir()

const FileSpec & GDBRemoteCommunicationServerPlatform::GetDomainSocketDir ( )
staticprivate

Definition at line 565 of file GDBRemoteCommunicationServerPlatform.cpp.

Referenced by GetDomainSocketPath().

◆ GetDomainSocketPath()

FileSpec GDBRemoteCommunicationServerPlatform::GetDomainSocketPath ( const char *  prefix)
staticprivate

◆ Handle_jSignalsInfo()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo ( StringExtractorGDBRemote packet)
protected

◆ Handle_qC()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qC ( StringExtractorGDBRemote packet)
protected

◆ Handle_qGetWorkingDir()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qGetWorkingDir ( StringExtractorGDBRemote packet)
protected

◆ Handle_qKillSpawnedProcess()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qKillSpawnedProcess ( StringExtractorGDBRemote packet)
protected

◆ Handle_qLaunchGDBServer()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer ( StringExtractorGDBRemote packet)
protected

◆ Handle_qPathComplete()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qPathComplete ( StringExtractorGDBRemote packet)
protected

◆ Handle_qProcessInfo()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qProcessInfo ( StringExtractorGDBRemote packet)
protected

◆ Handle_qQueryGDBServer()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_qQueryGDBServer ( StringExtractorGDBRemote packet)
protected

◆ Handle_QSetWorkingDir()

GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerPlatform::Handle_QSetWorkingDir ( StringExtractorGDBRemote packet)
protected

◆ KillSpawnedProcess()

bool GDBRemoteCommunicationServerPlatform::KillSpawnedProcess ( lldb::pid_t  pid)
private

◆ LaunchGDBServer()

Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer ( const lldb_private::Args args,
std::string  hostname,
lldb::pid_t pid,
std::optional< uint16_t > &  port,
std::string &  socket_name 
)

◆ LaunchProcess()

Status GDBRemoteCommunicationServerPlatform::LaunchProcess ( )
overridevirtual

◆ operator=()

const GDBRemoteCommunicationServerPlatform & lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::operator= ( const GDBRemoteCommunicationServerPlatform )
privatedelete

◆ SetInferiorArguments()

void lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::SetInferiorArguments ( const lldb_private::Args args)

◆ SetPendingGdbServer()

void GDBRemoteCommunicationServerPlatform::SetPendingGdbServer ( lldb::pid_t  pid,
uint16_t  port,
const std::string &  socket_name 
)

Definition at line 599 of file GDBRemoteCommunicationServerPlatform.cpp.

References m_pending_gdb_server, pid, port, and socket_name.

◆ SetPortMap()

void GDBRemoteCommunicationServerPlatform::SetPortMap ( PortMap &&  port_map)

Definition at line 561 of file GDBRemoteCommunicationServerPlatform.cpp.

References m_port_map.

◆ SetPortOffset()

void GDBRemoteCommunicationServerPlatform::SetPortOffset ( uint16_t  port_offset)

Definition at line 595 of file GDBRemoteCommunicationServerPlatform.cpp.

References m_port_offset.

Member Data Documentation

◆ 

struct { ... } lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_pending_gdb_server

◆ m_port_map

PortMap lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_port_map
protected

◆ m_port_offset

uint16_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_port_offset
protected

◆ m_socket_protocol

const Socket::SocketProtocol lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_socket_protocol
protected

Definition at line 100 of file GDBRemoteCommunicationServerPlatform.h.

Referenced by LaunchGDBServer().

◆ m_socket_scheme

const std::string lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_socket_scheme
protected

Definition at line 101 of file GDBRemoteCommunicationServerPlatform.h.

Referenced by LaunchGDBServer().

◆ m_spawned_pids

std::set<lldb::pid_t> lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_spawned_pids
protected

◆ m_spawned_pids_mutex

std::recursive_mutex lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_spawned_pids_mutex
protected

◆ pid

lldb::pid_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::pid

◆ port

uint16_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::port

◆ socket_name

std::string lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::socket_name

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