#include "GDBRemoteCommunication.h"
#include <climits>
#include <cstring>
#include <future>
#include <sys/stat.h>
#include "lldb/Host/Config.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/Host/Socket.h"
#include "lldb/Host/ThreadLauncher.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
#include "lldb/Target/Platform.h"
#include "lldb/Utility/Event.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/ScopedPrinter.h"
#include "ProcessGDBRemoteLog.h"
#if defined(__APPLE__)
#define DEBUGSERVER_BASENAME …
#elif defined(_WIN32)
#define DEBUGSERVER_BASENAME …
#else
#define DEBUGSERVER_BASENAME …
#endif
#if defined(HAVE_LIBCOMPRESSION)
#include <compression.h>
#endif
#if LLVM_ENABLE_ZLIB
#include <zlib.h>
#endif
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacelldb_private::process_gdb_remote;
GDBRemoteCommunication::GDBRemoteCommunication()
: … { … }
GDBRemoteCommunication::~GDBRemoteCommunication() { … }
char GDBRemoteCommunication::CalculcateChecksum(llvm::StringRef payload) { … }
size_t GDBRemoteCommunication::SendAck() { … }
size_t GDBRemoteCommunication::SendNack() { … }
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::SendPacketNoLock(llvm::StringRef payload) { … }
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::SendNotificationPacketNoLock(
llvm::StringRef notify_type, std::deque<std::string> &queue,
llvm::StringRef payload) { … }
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::SendRawPacketNoLock(llvm::StringRef packet,
bool skip_ack) { … }
GDBRemoteCommunication::PacketResult GDBRemoteCommunication::GetAck() { … }
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::ReadPacket(StringExtractorGDBRemote &response,
Timeout<std::micro> timeout,
bool sync_on_timeout) { … }
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet,
Timeout<std::micro> timeout,
bool sync_on_timeout) { … }
bool GDBRemoteCommunication::DecompressPacket() { … }
GDBRemoteCommunication::PacketType
GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len,
StringExtractorGDBRemote &packet) { … }
Status GDBRemoteCommunication::StartListenThread(const char *hostname,
uint16_t port) { … }
bool GDBRemoteCommunication::JoinListenThread() { … }
lldb::thread_result_t GDBRemoteCommunication::ListenThread() { … }
FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) { … }
Status GDBRemoteCommunication::StartDebugserverProcess(
const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) { … }
void GDBRemoteCommunication::DumpHistory(Stream &strm) { … }
llvm::Error
GDBRemoteCommunication::ConnectLocally(GDBRemoteCommunication &client,
GDBRemoteCommunication &server) { … }
GDBRemoteCommunication::ScopedTimeout::ScopedTimeout(
GDBRemoteCommunication &gdb_comm, std::chrono::seconds timeout)
: … { … }
GDBRemoteCommunication::ScopedTimeout::~ScopedTimeout() { … }
void llvm::format_provider<GDBRemoteCommunication::PacketResult>::format(
const GDBRemoteCommunication::PacketResult &result, raw_ostream &Stream,
StringRef Style) { … }
std::string GDBRemoteCommunication::ExpandRLE(std::string packet) { … }