LLDB mainline
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform Class Reference

#include <GDBRemoteCommunicationServerPlatform.h>

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

Public Member Functions

 GDBRemoteCommunicationServerPlatform (FileSpec debugserver_path, const Socket::SocketProtocol socket_protocol, uint16_t gdbserver_port)
 ~GDBRemoteCommunicationServerPlatform () override
Status LaunchProcess () override
 Launch a process with the current launch settings.
void SetInferiorArguments (const lldb_private::Args &args)
Status LaunchGDBServer (const lldb_private::Args &args, lldb::pid_t &pid, std::string &socket_name, shared_fd_t fd)
void SetPendingGdbServer (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
void DumpHistory (Stream &strm)
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 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 ()
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 FileSpec m_debugserver_path
const Socket::SocketProtocol m_socket_protocol
std::recursive_mutex m_spawned_pids_mutex
std::set< lldb::pid_tm_spawned_pids
uint16_t m_gdbserver_port
std::optional< std::string > m_pending_gdb_server_socket_name
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)
bool SpawnedProcessIsRunning (lldb::pid_t pid)
void AddSpawnedProcess (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
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 Status StartDebugserverProcess (std::variant< llvm::StringRef, shared_fd_t > comm, ProcessLaunchInfo &launch_info, const Args *inferior_args)
static std::optional< 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 ( FileSpec debugserver_path,
const Socket::SocketProtocol socket_protocol,
uint16_t gdbserver_port )

◆ ~GDBRemoteCommunicationServerPlatform()

GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform ( )
overridedefault

◆ GDBRemoteCommunicationServerPlatform() [2/2]

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

Member Function Documentation

◆ AddSpawnedProcess()

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

◆ DebugserverProcessReaped()

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

Definition at line 427 of file GDBRemoteCommunicationServerPlatform.cpp.

References m_spawned_pids, and m_spawned_pids_mutex.

Referenced by LaunchProcess().

◆ GetDomainSocketDir()

const FileSpec & GDBRemoteCommunicationServerPlatform::GetDomainSocketDir ( )
staticprivate

Definition at line 464 of file GDBRemoteCommunicationServerPlatform.cpp.

Referenced by GetDomainSocketPath().

◆ GetDomainSocketPath()

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

◆ Handle_jSignalsInfo()

◆ Handle_qC()

◆ Handle_qGetWorkingDir()

◆ Handle_qKillSpawnedProcess()

◆ Handle_qLaunchGDBServer()

◆ Handle_qPathComplete()

◆ Handle_qProcessInfo()

◆ Handle_qQueryGDBServer()

◆ Handle_QSetWorkingDir()

◆ KillSpawnedProcess()

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

◆ LaunchGDBServer()

◆ LaunchProcess()

Status GDBRemoteCommunicationServerPlatform::LaunchProcess ( )
overridevirtual

Launch a process with the current launch settings.

This method supports running an lldb-gdbserver or similar server in a situation where the startup code has been provided with all the information for a child process to be launched.

Returns
An Status object indicating the success or failure of the launch.

Implements lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon.

Definition at line 433 of file GDBRemoteCommunicationServerPlatform.cpp.

References AddSpawnedProcess(), DebugserverProcessReaped(), error(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::Host::LaunchProcess(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info.

◆ 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 ( const std::string & socket_name)

◆ SpawnedProcessIsRunning()

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

Member Data Documentation

◆ m_debugserver_path

const FileSpec lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_debugserver_path
protected

◆ m_gdbserver_port

uint16_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_gdbserver_port
protected

◆ m_pending_gdb_server_socket_name

std::optional<std::string> lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_pending_gdb_server_socket_name
protected

◆ m_socket_protocol

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

◆ 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

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