LLDB mainline
|
#include <GDBRemoteCommunicationServerPlatform.h>
Public Member Functions | |
GDBRemoteCommunicationServerPlatform (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 |
FileSpec | GetDebugserverPath (Platform *platform) |
Status | StartDebugserverProcess (const char *url, Platform *platform, ProcessLaunchInfo &launch_info, uint16_t *port, const Args *inferior_args, shared_fd_t 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) |
bool | SpawnedProcessIsRunning (lldb::pid_t pid) |
void | AddSpawnedProcess (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, |
uint16_t | gdbserver_port | ||
) |
Definition at line 48 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, lldb_private::Status::FromErrorString(), Handle_jSignalsInfo(), Handle_qC(), Handle_qGetWorkingDir(), Handle_qKillSpawnedProcess(), Handle_qLaunchGDBServer(), Handle_qPathComplete(), Handle_qProcessInfo(), Handle_qQueryGDBServer(), Handle_QSetWorkingDir(), 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 247 of file GDBRemoteCommunicationServerPlatform.cpp.
References LLDB_INVALID_PROCESS_ID, m_spawned_pids, and m_spawned_pids_mutex.
Referenced by LaunchGDBServer(), and LaunchProcess().
|
private |
Definition at line 427 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_spawned_pids, and m_spawned_pids_mutex.
Referenced by LaunchProcess().
|
staticprivate |
Definition at line 464 of file GDBRemoteCommunicationServerPlatform.cpp.
Referenced by GetDomainSocketPath().
|
staticprivate |
Definition at line 481 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::FileSpec::AppendPathComponent(), GetDomainSocketDir(), and lldb_private::FileSpec::GetPath().
Referenced by LaunchGDBServer().
|
protected |
Definition at line 400 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 373 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, lldb_private::Stream::Printf(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 348 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 228 of file GDBRemoteCommunicationServerPlatform.cpp.
References StringExtractor::GetU64(), KillSpawnedProcess(), LLDB_INVALID_PROCESS_ID, lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendOKResponse(), StringExtractor::SetFilePos(), and SpawnedProcessIsRunning().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 149 of file GDBRemoteCommunicationServerPlatform.cpp.
References error(), lldb_private::GetLog(), StringExtractor::GetNameColonValue(), lldb_private::StreamString::GetString(), lldb_private::Host::Kill(), lldb_private::SharedSocket::kInvalidFD, LaunchGDBServer(), LLDB_INVALID_PROCESS_ID, LLDB_LOGF, m_gdbserver_port, lldb_private::Platform, 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(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::Success.
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 316 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 298 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, lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock().
Referenced by GDBRemoteCommunicationServerPlatform().
|
protected |
Definition at line 201 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::StreamString::GetSize(), lldb_private::StreamString::GetString(), m_gdbserver_port, m_pending_gdb_server_socket_name, 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 361 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 259 of file GDBRemoteCommunicationServerPlatform.cpp.
References lldb_private::Host::Kill(), SIGKILL, and SpawnedProcessIsRunning().
Referenced by Handle_qKillSpawnedProcess().
Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer | ( | const lldb_private::Args & | args, |
lldb::pid_t & | pid, | ||
std::string & | socket_name, | ||
shared_fd_t | fd | ||
) |
Definition at line 94 of file GDBRemoteCommunicationServerPlatform.cpp.
References AddSpawnedProcess(), error(), lldb_private::Socket::FindSchemeByProtocol(), lldb_private::Status::FromErrorString(), lldb_private::process_gdb_remote::GDBRemoteCommunication::GetDebugserverPath(), GetDomainSocketPath(), lldb_private::GetLog(), lldb_private::FileSpec::GetPath(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::SharedSocket::kInvalidFD, LLDB_LOG, LLDB_LOGF, m_socket_protocol, lldb_private::Platform, lldb_private::Socket::ProtocolTcp, lldb_private::ProcessLaunchInfo::SetLaunchInSeparateProcessGroup(), lldb_private::ProcessLaunchInfo::SetMonitorProcessCallback(), 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 433 of file GDBRemoteCommunicationServerPlatform.cpp.
References AddSpawnedProcess(), DebugserverProcessReaped(), error(), lldb_private::Status::FromErrorStringWithFormat(), 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_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info, and lldb_private::ProcessLaunchInfo::SetMonitorProcessCallback().
|
privatedelete |
void lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::SetInferiorArguments | ( | const lldb_private::Args & | args | ) |
void GDBRemoteCommunicationServerPlatform::SetPendingGdbServer | ( | const std::string & | socket_name | ) |
Definition at line 494 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_pending_gdb_server_socket_name.
|
private |
Definition at line 253 of file GDBRemoteCommunicationServerPlatform.cpp.
References m_spawned_pids, and m_spawned_pids_mutex.
Referenced by Handle_qKillSpawnedProcess(), and KillSpawnedProcess().
|
protected |
Definition at line 47 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by Handle_qLaunchGDBServer(), and Handle_qQueryGDBServer().
|
protected |
Definition at line 48 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by Handle_qQueryGDBServer(), and SetPendingGdbServer().
|
protected |
Definition at line 43 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by LaunchGDBServer().
|
protected |
Definition at line 45 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by AddSpawnedProcess(), DebugserverProcessReaped(), and SpawnedProcessIsRunning().
|
protected |
Definition at line 44 of file GDBRemoteCommunicationServerPlatform.h.
Referenced by AddSpawnedProcess(), DebugserverProcessReaped(), and SpawnedProcessIsRunning().