LLDB mainline
|
#include <GDBRemoteCommunicationServerPlatform.h>
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::Connection * | GetConnection () |
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) |
Private Member Functions | |
bool | KillSpawnedProcess (lldb::pid_t pid) |
void | DebugserverProcessReaped (lldb::pid_t pid) |
GDBRemoteCommunicationServerPlatform (const GDBRemoteCommunicationServerPlatform &)=delete | |
const GDBRemoteCommunicationServerPlatform & | operator= (const GDBRemoteCommunicationServerPlatform &)=delete |
Static Private Member Functions | |
static const FileSpec & | GetDomainSocketDir () |
static FileSpec | GetDomainSocketPath (const char *prefix) |
Definition at line 25 of file GDBRemoteCommunicationServerPlatform.h.
GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform | ( | const Socket::SocketProtocol | socket_protocol, |
const char * | socket_scheme | ||
) |
Definition at line 113 of file GDBRemoteCommunicationServerPlatform.cpp.
References error(), StringExtractorGDBRemote::eServerPacketType_interrupt, StringExtractorGDBRemote::eServerPacketType_jSignalsInfo, StringExtractorGDBRemote::eServerPacketType_qC, StringExtractorGDBRemote::eServerPacketType_qGetWorkingDir, StringExtractorGDBRemote::eServerPacketType_qKillSpawnedProcess, StringExtractorGDBRemote::eServerPacketType_qLaunchGDBServer, StringExtractorGDBRemote::eServerPacketType_qPathComplete, StringExtractorGDBRemote::eServerPacketType_qProcessInfo, StringExtractorGDBRemote::eServerPacketType_qQueryGDBServer, StringExtractorGDBRemote::eServerPacketType_QSetWorkingDir, Handle_jSignalsInfo(), Handle_qC(), Handle_qGetWorkingDir(), Handle_qKillSpawnedProcess(), Handle_qLaunchGDBServer(), Handle_qPathComplete(), Handle_qProcessInfo(), Handle_qQueryGDBServer(), Handle_QSetWorkingDir(), LLDB_INVALID_PROCESS_ID, m_pending_gdb_server, lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::RegisterMemberFunctionHandler(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::RegisterPacketHandler(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::Success.
|
overridedefault |
|
privatedelete |
|
private |
Definition at line 521 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePortForProcess(), m_port_map, m_spawned_pids, m_spawned_pids_mutex, and pid.
Referenced by LaunchGDBServer(), and LaunchProcess().
|
staticprivate |
Definition at line 567 of file GDBRemoteCommunicationServerPlatform.cpp.
Referenced by GetDomainSocketPath().
|
staticprivate |
Definition at line 584 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::FileSpec::AppendPathComponent(), GetDomainSocketDir(), lldb_private::FileSpec::GetPath(), and socket_name.
Referenced by LaunchGDBServer().
|
protected |
Definition at line 494 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::UnixSignals::CreateForHost(), lldb_private::StructuredData::Object::Dump(), lldb_private::StreamString::GetString(), LLDB_INVALID_SIGNAL_NUMBER, lldb_private::StructuredData::Array::Push(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 467 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::ProcessLaunchInfo::Clear(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::StreamString::GetString(), LLDB_INVALID_PROCESS_ID, lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info, pid, lldb_private::Stream::Printf(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 442 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::StreamString::GetString(), lldb_private::Stream::PutBytesAsRawHex8(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 314 of file GDBRemoteCommunicationServerPlatform.cpp.
References StringExtractor::GetU64(), KillSpawnedProcess(), LLDB_INVALID_PROCESS_ID, m_spawned_pids, m_spawned_pids_mutex, pid, lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendOKResponse(), and StringExtractor::SetFilePos().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 228 of file GDBRemoteCommunicationServerPlatform.cpp.
References error(), lldb_private::GetLog(), StringExtractor::GetNameColonValue(), lldb_private::StreamString::GetString(), lldb_private::Host::Kill(), LaunchGDBServer(), LLDB_INVALID_PROCESS_ID, LLDB_LOGF, m_port_offset, lldb_private::Platform, port, lldb_private::Stream::Printf(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutCString(), lldb_private::Stream::PutStringAsRawHex8(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock(), StringExtractor::SetFilePos(), socket_name, and lldb_private::process_gdb_remote::GDBRemoteCommunication::Success.
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 410 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::StringList::begin(), lldb_private::CommandCompletions::DiskDirectories(), lldb_private::CommandCompletions::DiskFiles(), lldb_private::StringList::end(), StringExtractor::GetChar(), StringExtractor::GetHexByteString(), StringExtractor::GetHexMaxU32(), lldb_private::StreamString::GetString(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutStringAsRawHex8(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock(), and StringExtractor::SetFilePos().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 392 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::ProcessLaunchInfo::Clear(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse_DebugServerStyle(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::Host::GetProcessInfo(), lldb_private::StreamString::GetString(), LLDB_INVALID_PROCESS_ID, lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info, pid, lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 289 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::StreamString::GetSize(), lldb_private::StreamString::GetString(), LLDB_INVALID_PROCESS_ID, m_pending_gdb_server, lldb_private::StreamGDBRemote::PutEscapedBytes(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 455 of file GDBRemoteCommunicationServerPlatform.cpp.
References StringExtractor::GetHexByteString(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendOKResponse(), and StringExtractor::SetFilePos().
Referenced by GDBRemoteCommunicationServerPlatform().
|
private |
Definition at line 336 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::Host::Kill(), m_spawned_pids, m_spawned_pids_mutex, pid, and SIGKILL.
Referenced by Handle_qKillSpawnedProcess().
Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer | ( | const lldb_private::Args & | args, |
std::string | hostname, | ||
lldb::pid_t & | pid, | ||
std::optional< uint16_t > & | port, | ||
std::string & | socket_name | ||
) |
Definition at line 162 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AssociatePortWithProcess(), DebugserverProcessReaped(), error(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePort(), lldb_private::Communication::GetConnection(), GetDomainSocketPath(), lldb_private::GetLog(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::GetNextAvailablePort(), lldb_private::FileSpec::GetPath(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::Connection::GetURI(), LLDB_INVALID_PROCESS_ID, LLDB_LOGF, m_port_map, m_socket_protocol, m_socket_scheme, m_spawned_pids, m_spawned_pids_mutex, lldb_private::URI::Parse(), pid, lldb_private::Platform, port, lldb_private::Socket::ProtocolTcp, lldb_private::ProcessLaunchInfo::SetLaunchInSeparateProcessGroup(), lldb_private::ProcessLaunchInfo::SetMonitorProcessCallback(), socket_name, and lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess().
Referenced by Handle_qLaunchGDBServer().
|
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.
Implements lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon.
Definition at line 528 of file GDBRemoteCommunicationServerPlatform.cpp.
References DebugserverProcessReaped(), error(), lldb_private::Args::GetArgumentAtIndex(), lldb_private::Args::GetArgumentCount(), lldb_private::ProcessInfo::GetArguments(), lldb_private::ProcessLaunchInfo::GetMonitorProcessCallback(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::Host::LaunchProcess(), LLDB_INVALID_PROCESS_ID, lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info, m_spawned_pids, m_spawned_pids_mutex, pid, and lldb_private::ProcessLaunchInfo::SetMonitorProcessCallback().
|
privatedelete |
void lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::SetInferiorArguments | ( | const lldb_private::Args & | args | ) |
void GDBRemoteCommunicationServerPlatform::SetPendingGdbServer | ( | lldb::pid_t | pid, |
uint16_t | port, | ||
const std::string & | socket_name | ||
) |
Definition at line 601 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_pending_gdb_server, pid, port, and socket_name.
void GDBRemoteCommunicationServerPlatform::SetPortMap | ( | PortMap && | port_map | ) |
Definition at line 563 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_port_map.
void GDBRemoteCommunicationServerPlatform::SetPortOffset | ( | uint16_t | port_offset | ) |
Definition at line 597 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_port_offset.
struct { ... } lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::m_pending_gdb_server |
Referenced by GDBRemoteCommunicationServerPlatform(), Handle_qQueryGDBServer(), and SetPendingGdbServer().
|
protected |
Definition at line 105 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AllowPort(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AssociatePortWithProcess(), DebugserverProcessReaped(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::empty(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePort(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePortForProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::GetNextAvailablePort(), LaunchGDBServer(), and SetPortMap().
|
protected |
Definition at line 106 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by Handle_qLaunchGDBServer(), and SetPortOffset().
|
protected |
Definition at line 100 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by LaunchGDBServer().
|
protected |
Definition at line 101 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by LaunchGDBServer().
|
protected |
Definition at line 103 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by DebugserverProcessReaped(), Handle_qKillSpawnedProcess(), KillSpawnedProcess(), LaunchGDBServer(), and LaunchProcess().
|
protected |
Definition at line 102 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by DebugserverProcessReaped(), Handle_qKillSpawnedProcess(), KillSpawnedProcess(), LaunchGDBServer(), and LaunchProcess().
lldb::pid_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::pid |
Definition at line 108 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AssociatePortWithProcess(), DebugserverProcessReaped(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePortForProcess(), Handle_qC(), Handle_qKillSpawnedProcess(), Handle_qProcessInfo(), KillSpawnedProcess(), LaunchGDBServer(), LaunchProcess(), and SetPendingGdbServer().
uint16_t lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::port |
Definition at line 109 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AllowPort(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::AssociatePortWithProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::PortMap::FreePort(), Handle_qLaunchGDBServer(), LaunchGDBServer(), and SetPendingGdbServer().
std::string lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::socket_name |
Definition at line 110 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by GetDomainSocketPath(), Handle_qLaunchGDBServer(), LaunchGDBServer(), and SetPendingGdbServer().