LLDB  mainline
Classes | Public Member Functions | Protected Member Functions | List of all members
lldb_private::process_gdb_remote::GDBRemoteClientBase Class Reference

#include <GDBRemoteClientBase.h>

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

Classes

struct  ContinueDelegate
 
class  Lock
 

Public Member Functions

 GDBRemoteClientBase (const char *comm_name, const char *listener_name)
 
bool SendAsyncSignal (int signo)
 
bool Interrupt ()
 
lldb::StateType SendContinuePacketAndWaitForResponse (ContinueDelegate &delegate, const UnixSignals &signals, llvm::StringRef payload, StringExtractorGDBRemote &response)
 
PacketResult SendPacketAndWaitForResponse (llvm::StringRef payload, StringExtractorGDBRemote &response, bool send_async)
 
PacketResult SendPacketAndReceiveResponseWithOutputSupport (llvm::StringRef payload, StringExtractorGDBRemote &response, bool send_async, llvm::function_ref< void(llvm::StringRef)> output_callback)
 
bool SendvContPacket (llvm::StringRef payload, StringExtractorGDBRemote &response)
 
- Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
 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 SetHistoryStream (llvm::raw_ostream *strm)
 
- Public Member Functions inherited from lldb_private::Communication
 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::ConnectionGetConnection ()
 
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...
 
void SetConnection (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...
 
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)
 
ConstStringGetBroadcasterClass () const override
 
- Public Member Functions inherited from lldb_private::Broadcaster
 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 ()
 

Protected Member Functions

PacketResult SendPacketAndWaitForResponseNoLock (llvm::StringRef payload, StringExtractorGDBRemote &response)
 
virtual void OnRunPacketSent (bool first)
 
- Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
PacketResult SendPacketNoLock (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 PopPacketFromQueue (StringExtractorGDBRemote &response, Timeout< std::micro > 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 ()
 
void AppendBytesToCache (const uint8_t *bytes, size_t len, bool broadcast, lldb::ConnectionStatus status) override
 Append new bytes that get read from the read thread into the internal object byte cache. More...
 
- 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)
 
size_t GetCachedBytes (void *dst, size_t dst_len)
 Get any available bytes from our data cache. More...
 
- Protected Member Functions inherited from lldb_private::Broadcaster
BroadcasterImplSP GetBroadcasterImpl ()
 
const char * GetHijackingListenerName ()
 

Additional Inherited Members

- Public Types inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
enum  { eBroadcastBitRunPacketSent = kLoUserBroadcastBit, eBroadcastBitGdbReadThreadGotNotify }
 
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
}
 
- Public Types inherited from lldb_private::Communication
typedef void(* ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len)
 
- Static Public Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
static llvm::Error ConnectLocally (GDBRemoteCommunication &client, GDBRemoteCommunication &server)
 
- Static Public Member Functions inherited from lldb_private::Communication
static lldb::thread_result_t ReadThread (lldb::thread_arg_t comm_ptr)
 The static read thread function. More...
 
static const char * ConnectionStatusAsCString (lldb::ConnectionStatus status)
 
static ConstStringGetStaticBroadcasterClass ()
 
- Protected Types inherited from lldb_private::Broadcaster
typedef std::shared_ptr< BroadcasterImplBroadcasterImplSP
 
typedef std::weak_ptr< BroadcasterImplBroadcasterImplWP
 
- Static Protected Member Functions inherited from lldb_private::process_gdb_remote::GDBRemoteCommunication
static lldb::thread_result_t ListenThread (lldb::thread_arg_t arg)
 
- 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
 
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. 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
 

Detailed Description

Definition at line 19 of file GDBRemoteClientBase.h.

Constructor & Destructor Documentation

◆ GDBRemoteClientBase()

GDBRemoteClientBase::GDBRemoteClientBase ( const char *  comm_name,
const char *  listener_name 
)

Definition at line 31 of file GDBRemoteClientBase.cpp.

Member Function Documentation

◆ Interrupt()

bool GDBRemoteClientBase::Interrupt ( )

◆ OnRunPacketSent()

void GDBRemoteClientBase::OnRunPacketSent ( bool  first)
protectedvirtual

◆ SendAsyncSignal()

bool GDBRemoteClientBase::SendAsyncSignal ( int  signo)

◆ SendContinuePacketAndWaitForResponse()

StateType GDBRemoteClientBase::SendContinuePacketAndWaitForResponse ( ContinueDelegate delegate,
const UnixSignals signals,
llvm::StringRef  payload,
StringExtractorGDBRemote response 
)

◆ SendPacketAndReceiveResponseWithOutputSupport()

GDBRemoteCommunication::PacketResult GDBRemoteClientBase::SendPacketAndReceiveResponseWithOutputSupport ( llvm::StringRef  payload,
StringExtractorGDBRemote response,
bool  send_async,
llvm::function_ref< void(llvm::StringRef)>  output_callback 
)

◆ SendPacketAndWaitForResponse()

GDBRemoteCommunication::PacketResult GDBRemoteClientBase::SendPacketAndWaitForResponse ( llvm::StringRef  payload,
StringExtractorGDBRemote response,
bool  send_async 
)

Definition at line 158 of file GDBRemoteClientBase.cpp.

References lldb_private::process_gdb_remote::GDBRemoteCommunication::ErrorSendFailed, GDBR_LOG_PROCESS, lldb_private::process_gdb_remote::ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(), and SendPacketAndWaitForResponseNoLock().

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AllocateMemory(), lldb_private::process_gdb_remote::ProcessGDBRemote::BuildDynamicRegisterInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::CalculateMD5(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::CloseFile(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(), lldb_private::process_gdb_remote::ProcessGDBRemote::ConnectToDebugserver(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::CreateSymlink(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::DeallocateMemory(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::Detach(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoDestroy(), CommandObjectProcessGDBRemotePacketSend::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoReadMemory(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoWriteMemory(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::EnableErrorStringInPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::FindProcesses(), lldb_private::process_gdb_remote::ProcessGDBRemote::FlashDone(), lldb_private::process_gdb_remote::ProcessGDBRemote::FlashErase(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetCurrentProcessID(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetCurrentProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetDefaultThreadId(), lldb_private::process_gdb_remote::ProcessGDBRemote::GetExtendedInfoForThread(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFileExists(), lldb_private::process_gdb_remote::ProcessGDBRemote::GetFileLoadAddress(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFilePermissions(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFileSize(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetGDBServerVersion(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetGroupName(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetHostInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetLaunchSuccess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetListThreadsInStopReplySupported(), lldb_private::process_gdb_remote::ProcessGDBRemote::GetLoadedDynamicLibrariesInfos_sender(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetLoadedDynamicLibrariesInfosSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetMemoryRegionInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetModuleInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetModulesInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetRemoteQSupported(), lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteUnixSignals(), lldb_private::process_gdb_remote::ProcessGDBRemote::GetSharedCacheInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetSharedCacheInfoSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetShlibInfoAddr(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetStopReply(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetSyncThreadStateSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetThreadExtendedInfoSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetThreadsInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetThreadStopInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetThreadSuffixSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetUserName(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetVAttachOrWaitSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetVContSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetWatchpointSupportInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetWorkingDir(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetxPacketSupported(), lldb_private::process_gdb_remote::ProcessGDBRemote::HandleStopReplySequence(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::KillSpawnedProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::LaunchGDBServer(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::MakeDirectory(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::MaybeEnableCompression(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::OpenFile(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::QueryGDBServer(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::QueryNoAckModeSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::ReadExtFeature(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::ReadFile(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::RunShellCommand(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendArgumentsPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendAttach(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendEnvironmentPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendGDBStoppointTypePacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendGetTraceConfigPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendGetTraceDataPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendLaunchArchPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendLaunchEventDataPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendSignalsToIgnore(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendSpeedTestPacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendStartTracePacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendStdinNotification(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendStopTracePacket(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetCurrentThread(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetCurrentThreadForRun(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetDetachOnError(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetDisableASLR(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetFilePermissions(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetNonStopMode(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDERR(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDIN(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDOUT(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetWorkingDir(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SyncThreadState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::TestPacketSpeed(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::Unlink(), and lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::WriteFile().

◆ SendPacketAndWaitForResponseNoLock()

GDBRemoteCommunication::PacketResult GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock ( llvm::StringRef  payload,
StringExtractorGDBRemote response 
)
protected

◆ SendvContPacket()

bool GDBRemoteClientBase::SendvContPacket ( llvm::StringRef  payload,
StringExtractorGDBRemote response 
)

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