LLDB
mainline
|
#include <GDBRemoteCommunication.h>
Classes | |
class | ScopedTimeout |
Public Types | |
enum | { eBroadcastBitRunPacketSent = kLoUserBroadcastBit } |
enum | PacketType { PacketType::Invalid = 0, PacketType::Standard, PacketType::Notify } |
enum | PacketResult { PacketResult::Success = 0, PacketResult::ErrorSendFailed, PacketResult::ErrorSendAck, PacketResult::ErrorReplyFailed, PacketResult::ErrorReplyTimeout, PacketResult::ErrorReplyInvalid, PacketResult::ErrorReplyAck, PacketResult::ErrorDisconnected, PacketResult::ErrorNoSequenceLock } |
![]() | |
typedef void(* | ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len) |
Public Member Functions | |
GDBRemoteCommunication (const char *comm_name, const char *listener_name) | |
~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) |
![]() | |
FLAGS_ANONYMOUS_ENUM () | |
Communication (const char *broadcaster_name) | |
Construct the Communication object with the specified name for the Broadcaster that this object inherits from. More... | |
~Communication () override | |
Destructor. More... | |
void | Clear () |
lldb::ConnectionStatus | Connect (const char *url, Status *error_ptr) |
Connect using the current connection by passing url to its connect function. More... | |
lldb::ConnectionStatus | Disconnect (Status *error_ptr=nullptr) |
Disconnect the communications connection if one is currently connected. More... | |
bool | IsConnected () const |
Check if the connection is valid. More... | |
bool | HasConnection () const |
lldb_private::Connection * | GetConnection () |
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. More... | |
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. More... | |
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. More... | |
void | SetConnection (std::unique_ptr< Connection > connection) |
Sets the connection that it to be used by this class. More... | |
virtual bool | StartReadThread (Status *error_ptr=nullptr) |
Starts a read thread whose sole purpose it to read bytes from the current connection. More... | |
virtual bool | StopReadThread (Status *error_ptr=nullptr) |
Stops the read thread by cancelling it. More... | |
virtual bool | JoinReadThread (Status *error_ptr=nullptr) |
bool | ReadThreadIsRunning () |
Checks if there is a currently running read thread. More... | |
lldb::thread_result_t | ReadThread () |
The read thread function. More... | |
void | SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback, void *callback_baton) |
void | SynchronizeWithReadThread () |
Wait for the read thread to process all outstanding data. More... | |
bool | GetCloseOnEOF () const |
void | SetCloseOnEOF (bool b) |
ConstString & | GetBroadcasterClass () const override |
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching. More... | |
![]() | |
Broadcaster (lldb::BroadcasterManagerSP manager_sp, const char *name) | |
Construct with a broadcaster with a name. More... | |
virtual | ~Broadcaster () |
Destructor. More... | |
void | CheckInWithManager () |
void | BroadcastEvent (lldb::EventSP &event_sp) |
Broadcast an event which has no associated data. More... | |
void | BroadcastEventIfUnique (lldb::EventSP &event_sp) |
void | BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp) |
void | BroadcastEvent (uint32_t event_type, EventData *event_data=nullptr) |
void | BroadcastEventIfUnique (uint32_t event_type, EventData *event_data=nullptr) |
void | Clear () |
virtual void | AddInitialEventsToListener (const lldb::ListenerSP &listener_sp, uint32_t requested_events) |
uint32_t | AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask) |
Listen for any events specified by event_mask. More... | |
ConstString | GetBroadcasterName () |
Get the NULL terminated C string name of this Broadcaster object. More... | |
bool | GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const |
Get the event name(s) for one or more event bits. More... | |
void | SetEventName (uint32_t event_mask, const char *name) |
Set the name for an event bit. More... | |
const char * | GetEventName (uint32_t event_mask) const |
bool | EventTypeHasListeners (uint32_t event_type) |
bool | RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
Removes a Listener from this broadcasters list and frees the event bits specified by event_mask that were previously acquired by listener (assuming listener was listening to this object) for other listener objects to use. More... | |
bool | HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
Provides a simple mechanism to temporarily redirect events from broadcaster. More... | |
bool | IsHijackedForEvent (uint32_t event_mask) |
void | RestoreBroadcaster () |
Restore the state of the Broadcaster from a previous hijack attempt. More... | |
lldb::BroadcasterManagerSP | GetManager () |
Static Public Member Functions | |
static llvm::Error | ConnectLocally (GDBRemoteCommunication &client, GDBRemoteCommunication &server) |
static std::string | ExpandRLE (std::string) |
Expand GDB run-length encoding. More... | |
![]() | |
static std::string | ConnectionStatusAsString (lldb::ConnectionStatus status) |
static ConstString & | GetStaticBroadcasterClass () |
Protected Member Functions | |
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 | ReadPacketWithOutputSupport (StringExtractorGDBRemote &response, Timeout< std::micro > timeout, bool sync_on_timeout, llvm::function_ref< void(llvm::StringRef)> output_callback) |
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 () |
![]() | |
size_t | ReadFromConnection (void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr) |
virtual void | AppendBytesToCache (const uint8_t *src, size_t src_len, bool broadcast, lldb::ConnectionStatus status) |
Append new bytes that get read from the read thread into the internal object byte cache. More... | |
size_t | GetCachedBytes (void *dst, size_t dst_len) |
Get any available bytes from our data cache. More... | |
![]() | |
BroadcasterImplSP | GetBroadcasterImpl () |
const char * | GetHijackingListenerName () |
Protected Attributes | |
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 |
CompressionType | m_compression_type |
![]() | |
lldb::ConnectionSP | m_connection_sp |
The connection that is current in use by this communications class. More... | |
HostThread | m_read_thread |
The read thread handle in case we need to cancel the thread. More... | |
std::atomic< bool > | m_read_thread_enabled |
std::atomic< bool > | m_read_thread_did_exit |
std::string | m_bytes |
A buffer to cache bytes read in the ReadThread function. More... | |
std::recursive_mutex | m_bytes_mutex |
A mutex to protect multi-threaded access to the cached bytes. More... | |
std::mutex | m_write_mutex |
Don't let multiple threads write at the same time... More... | |
std::mutex | m_synchronize_mutex |
ReadThreadBytesReceived | m_callback |
void * | m_callback_baton |
bool | m_close_on_eof |
Private Member Functions | |
GDBRemoteCommunication (const GDBRemoteCommunication &)=delete | |
const GDBRemoteCommunication & | operator= (const GDBRemoteCommunication &)=delete |
Private Attributes | |
std::promise< uint16_t > | m_port_promise |
HostThread | m_listen_thread |
std::string | m_listen_url |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< BroadcasterImpl > | BroadcasterImplSP |
typedef std::weak_ptr< BroadcasterImpl > | BroadcasterImplWP |
Definition at line 83 of file GDBRemoteCommunication.h.
anonymous enum |
Enumerator | |
---|---|
eBroadcastBitRunPacketSent |
Definition at line 85 of file GDBRemoteCommunication.h.
Enumerator | |
---|---|
Success | |
ErrorSendFailed | |
ErrorSendAck | |
ErrorReplyFailed | |
ErrorReplyTimeout | |
ErrorReplyInvalid | |
ErrorReplyAck | |
ErrorDisconnected | |
ErrorNoSequenceLock |
Definition at line 91 of file GDBRemoteCommunication.h.
Enumerator | |
---|---|
Invalid | |
Standard | |
Notify |
Definition at line 89 of file GDBRemoteCommunication.h.
GDBRemoteCommunication::GDBRemoteCommunication | ( | const char * | comm_name, |
const char * | listener_name | ||
) |
Definition at line 61 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::None.
|
override |
Definition at line 75 of file GDBRemoteCommunication.cpp.
References lldb_private::Communication::Disconnect(), and lldb_private::Communication::IsConnected().
|
privatedelete |
char GDBRemoteCommunication::CalculcateChecksum | ( | llvm::StringRef | payload | ) |
Definition at line 86 of file GDBRemoteCommunication.cpp.
Referenced by CheckForPacket(), DecompressPacket(), SendNotificationPacketNoLock(), and SendPacketNoLock().
GDBRemoteCommunication::PacketType GDBRemoteCommunication::CheckForPacket | ( | const uint8_t * | src, |
size_t | src_len, | ||
StringExtractorGDBRemote & | packet | ||
) |
Definition at line 637 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::AddPacket(), CalculcateChecksum(), StringExtractor::Clear(), CompressionIsEnabled(), DecompressPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::DidDumpToLog(), lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Dump(), lldb_private::GDBRemotePacket::ePacketTypeRecv, ExpandRLE(), lldb_private::GetLog(), GetSendAcks(), lldb_private::StreamString::GetString(), lldb_private::Log::GetVerbose(), Invalid, LLDB_LOGF, lldb_private::Communication::m_bytes, lldb_private::Communication::m_bytes_mutex, m_history, Notify, lldb_private::process_gdb_remote::Packets, lldb_private::Stream::Printf(), lldb_private::Log::PutString(), SendAck(), SendNack(), StringExtractor::SetFilePos(), Standard, and string().
Referenced by WaitForPacketNoLock().
|
inlineprotected |
Definition at line 204 of file GDBRemoteCommunication.h.
References m_compression_type, and lldb_private::process_gdb_remote::None.
Referenced by CheckForPacket(), and DecompressPacket().
|
static |
Definition at line 1234 of file GDBRemoteCommunication.cpp.
References lldb_private::TCPSocket::Accept(), lldb_private::Status::AsCString(), lldb::eConnectionStatusSuccess, error(), lldb_private::TCPSocket::GetLocalPortNumber(), lldb_private::TCPSocket::Listen(), lldb_private::Communication::SetConnection(), and lldb_private::Status::ToError().
|
protected |
Definition at line 407 of file GDBRemoteCommunication.cpp.
References CalculcateChecksum(), CompressionIsEnabled(), lldb_private::GetLog(), GetSendAcks(), LLDB_LOGF, lldb_private::process_gdb_remote::LZ4, lldb_private::process_gdb_remote::LZFSE, lldb_private::process_gdb_remote::LZMA, lldb_private::Communication::m_bytes, m_compression_type, lldb_private::process_gdb_remote::Packets, SendAck(), SendNack(), string(), x20, and lldb_private::process_gdb_remote::ZlibDeflate.
Referenced by CheckForPacket().
void GDBRemoteCommunication::DumpHistory | ( | Stream & | strm | ) |
Definition at line 1226 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Dump(), and m_history.
Referenced by CommandObjectProcessGDBRemotePacketHistory::DoExecute(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().
|
static |
Expand GDB run-length encoding.
Definition at line 1321 of file GDBRemoteCommunication.cpp.
References string().
Referenced by CheckForPacket().
GDBRemoteCommunication::PacketResult GDBRemoteCommunication::GetAck | ( | ) |
Definition at line 212 of file GDBRemoteCommunication.cpp.
References ErrorSendAck, GetPacketTimeout(), StringExtractorGDBRemote::GetResponseType(), Success, and WaitForPacketNoLock().
Referenced by SendRawPacketNoLock().
|
inline |
Definition at line 151 of file GDBRemoteCommunication.h.
References m_packet_timeout.
Referenced by GetAck(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::QueryNoAckModeSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunication::ScopedTimeout::ScopedTimeout(), lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport(), and lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock().
|
inline |
Definition at line 138 of file GDBRemoteCommunication.h.
References m_send_acks.
Referenced by CheckForPacket(), DecompressPacket(), and SendRawPacketNoLock().
|
protected |
Definition at line 877 of file GDBRemoteCommunication.cpp.
References lldb_private::HostThread::IsJoinable(), lldb_private::HostThread::Join(), and m_listen_thread.
Referenced by StartDebugserverProcess().
|
protected |
Definition at line 883 of file GDBRemoteCommunication.cpp.
References lldb_private::ConnectionFileDescriptor::Connect(), lldb::eConnectionStatusSuccess, error(), lldb_private::Communication::GetConnection(), m_listen_url, and lldb_private::Communication::SetConnection().
Referenced by StartListenThread().
|
privatedelete |
|
protected |
Definition at line 243 of file GDBRemoteCommunication.cpp.
References lldb_private::GetLog(), StringExtractorGDBRemote::GetResponseType(), StringExtractor::GetStringRef(), LLDB_LOG, lldb_private::process_gdb_remote::Packets, Success, and WaitForPacketNoLock().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::GetPacketAndSendResponse(), ReadPacketWithOutputSupport(), lldb_private::process_gdb_remote::GDBRemoteClientBase::SendContinuePacketAndWaitForResponse(), lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock(), and lldb_private::process_gdb_remote::GDBRemoteClientBase::ShouldStop().
|
protected |
Definition at line 226 of file GDBRemoteCommunication.cpp.
References StringExtractor::GetChar(), StringExtractor::GetHexByteString(), StringExtractorGDBRemote::IsNormalResponse(), StringExtractor::PeekChar(), ReadPacket(), string(), and Success.
Referenced by lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport().
size_t GDBRemoteCommunication::SendAck | ( | ) |
Definition at line 95 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::AddPacket(), lldb::eConnectionStatusSuccess, lldb_private::GDBRemotePacket::ePacketTypeSend, lldb_private::GetLog(), LLDB_LOGF, m_history, lldb_private::process_gdb_remote::Packets, and lldb_private::Communication::WriteAll().
Referenced by CheckForPacket(), DecompressPacket(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::HandshakeWithServer().
size_t GDBRemoteCommunication::SendNack | ( | ) |
Definition at line 105 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::AddPacket(), lldb::eConnectionStatusSuccess, lldb_private::GDBRemotePacket::ePacketTypeSend, lldb_private::GetLog(), LLDB_LOGF, m_history, lldb_private::process_gdb_remote::Packets, and lldb_private::Communication::WriteAll().
Referenced by CheckForPacket(), and DecompressPacket().
|
protected |
Definition at line 128 of file GDBRemoteCommunication.cpp.
References CalculcateChecksum(), lldb::eByteOrderBig, lldb_private::StreamString::GetString(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutHex8(), SendRawPacketNoLock(), Success, and lldb_private::Stream::Write().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendWResponse().
|
protected |
Definition at line 116 of file GDBRemoteCommunication.cpp.
References CalculcateChecksum(), lldb::eByteOrderBig, lldb_private::StreamString::GetString(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutHex8(), SendRawPacketNoLock(), string(), and lldb_private::Stream::Write().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle__M(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_g(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetBinaryData(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_jModulesInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_memory_read(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_p(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qC(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qC(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qEcho(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qfThreadInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qGetWorkingDir(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qGetWorkingDir(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qGroupName(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qHostInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qLaunchSuccess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemTags(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qModuleInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qPathComplete(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_chmod(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_mkdir(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qProcessInfoPID(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::Handle_qQueryGDBServer(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qSpeedTest(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qsProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qsThreadInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qUserName(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qXfer(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_stop_reason(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_vCont_actions(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Close(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Exists(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_FStat(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_MD5(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Mode(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Open(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_pRead(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_pWrite(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Size(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_symlink(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_unlink(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_vStopped(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendOKResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendONotification(), lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport(), lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendStopReplyPacketForThread(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendUnimplementedResponse(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendWResponse(), and WaitForPacketNoLock().
|
protected |
Definition at line 151 of file GDBRemoteCommunication.cpp.
References lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::AddPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::DidDumpToLog(), lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::Dump(), lldb::eConnectionStatusSuccess, lldb_private::GDBRemotePacket::ePacketTypeSend, ErrorSendFailed, GetAck(), lldb_private::GetLog(), GetSendAcks(), lldb_private::StreamString::GetString(), lldb_private::Communication::IsConnected(), LLDB_LOGF, m_history, lldb_private::process_gdb_remote::Packets, lldb_private::Stream::Printf(), lldb_private::Log::PutString(), Success, and lldb_private::Communication::WriteAll().
Referenced by SendNotificationPacketNoLock(), and SendPacketNoLock().
void GDBRemoteCommunication::SetPacketRecorder | ( | repro::PacketRecorder * | recorder | ) |
Definition at line 1228 of file GDBRemoteCommunication.cpp.
References m_history, and lldb_private::process_gdb_remote::GDBRemoteCommunicationHistory::SetRecorder().
|
inline |
Definition at line 145 of file GDBRemoteCommunication.h.
References m_packet_timeout.
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetHostInfo(), and lldb_private::process_gdb_remote::GDBRemoteCommunication::ScopedTimeout::ScopedTimeout().
Status GDBRemoteCommunication::StartDebugserverProcess | ( | const char * | url, |
Platform * | platform, | ||
ProcessLaunchInfo & | launch_info, | ||
uint16_t * | port, | ||
const Args * | inferior_args, | ||
int | pass_comm_fd | ||
) |
Definition at line 903 of file GDBRemoteCommunication.cpp.
References lldb_private::Args::AppendArgument(), lldb_private::Args::AppendArguments(), lldb_private::ProcessLaunchInfo::AppendCloseFileAction(), lldb_private::ProcessLaunchInfo::AppendDuplicateFileAction(), lldb_private::FileSpec::AppendPathComponent(), lldb_private::ProcessLaunchInfo::AppendSuppressFileAction(), lldb_private::FileSpec::Clear(), lldb_private::Args::Clear(), DEBUGSERVER_BASENAME, lldb_private::ProcessInfo::Dump(), error(), lldb_private::FileSystem::Exists(), lldb_private::Args::GetArgumentCount(), lldb_private::ProcessInfo::GetArguments(), lldb_private::StreamString::GetData(), lldb_private::ProcessInfo::GetEnvironment(), lldb_private::Host::GetEnvironment(), lldb_private::ProcessInfo::GetExecutableFile(), lldb_private::ProcessLaunchInfo::GetLaunchInSeparateProcessGroup(), lldb_private::GetLog(), lldb_private::FileSpec::GetPath(), lldb_private::ProcessInfo::GetProcessID(), lldb_private::StreamString::GetString(), lldb_private::FileSystem::Instance(), JoinListenThread(), lldb_private::Host::LaunchProcess(), LLDB_INVALID_PROCESS_ID, LLDB_LOGF, lldb_private::Platform::LocateExecutable(), m_port_promise, PATH_MAX, lldb_private::Stream::Printf(), lldb_private::process_gdb_remote::Process, lldb_private::FileSpec::SetFile(), StartListenThread(), and string().
Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchGDBServer().
|
protected |
Definition at line 856 of file GDBRemoteCommunication.cpp.
References lldb_private::HostThread::IsJoinable(), lldb_private::ThreadLauncher::LaunchThread(), ListenThread(), m_listen_thread, m_listen_url, and lldb_private::Communication::SetConnection().
Referenced by StartDebugserverProcess().
|
protected |
Sync the remote GDB server and make sure we get a response that corresponds to what we send.
Sends a "qEcho" packet and makes sure it gets the exact packet echoed back. If the qEcho packet isn't supported, we send a qC packet and make sure we get a valid thread ID back. We use the "qC" packet since its response if very unique: is responds with "QC%x" where x is the thread ID of the current thread. This makes the response unique enough from other packet responses to ensure we are back on track.
This packet is needed after we time out sending a packet so we can ensure that we are getting the response for the packet we are sending. There are no sequence IDs in the GDB remote protocol (there used to be, but they are not supported anymore) so if you timeout sending packet "abc", you might then send packet "cde" and get the response for the previous "abc" packet. Many responses are "OK" or "" (unsupported) or "EXX" (error) so many responses for packets can look like responses for other packets. So if we timeout, we need to ensure that we can get back on track. If we can't get back on track, we must disconnect.
Definition at line 261 of file GDBRemoteCommunication.cpp.
References CheckForPacket(), StringExtractor::Clear(), lldb_private::Communication::ConnectionStatusAsString(), lldb_private::Communication::Disconnect(), lldb::eConnectionStatusEndOfFile, lldb::eConnectionStatusError, lldb::eConnectionStatusInterrupted, lldb::eConnectionStatusLostConnection, lldb::eConnectionStatusNoConnection, lldb::eConnectionStatusSuccess, lldb::eConnectionStatusTimedOut, lldb_private::eLazyBoolYes, error(), ErrorDisconnected, ErrorReplyFailed, ErrorReplyTimeout, lldb_private::RegularExpression::Execute(), lldb_private::GetLog(), StringExtractor::GetStringRef(), Invalid, lldb_private::Communication::IsConnected(), LLDB_LOGV, m_echo_number, m_supports_qEcho, lldb_private::process_gdb_remote::Packets, lldb_private::Communication::Read(), SendPacketNoLock(), string(), and Success.
Referenced by GetAck(), and ReadPacket().
|
protected |
Definition at line 183 of file GDBRemoteCommunication.h.
Referenced by CompressionIsEnabled(), DecompressPacket(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::MaybeEnableCompression().
|
protected |
Definition at line 175 of file GDBRemoteCommunication.h.
Referenced by WaitForPacketNoLock().
|
protected |
Definition at line 177 of file GDBRemoteCommunication.h.
Referenced by CheckForPacket(), DumpHistory(), SendAck(), SendNack(), SendRawPacketNoLock(), and SetPacketRecorder().
|
protected |
Definition at line 179 of file GDBRemoteCommunication.h.
|
private |
Definition at line 230 of file GDBRemoteCommunication.h.
Referenced by JoinListenThread(), and StartListenThread().
|
private |
Definition at line 231 of file GDBRemoteCommunication.h.
Referenced by ListenThread(), and StartListenThread().
|
protected |
Definition at line 174 of file GDBRemoteCommunication.h.
Referenced by GetPacketTimeout(), and SetPacketTimeout().
|
private |
Definition at line 228 of file GDBRemoteCommunication.h.
Referenced by StartDebugserverProcess().
|
protected |
|
protected |