From ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:12:36 +0000 Subject: Vendor import of lldb trunk r321017: https://llvm.org/svn/llvm-project/lldb/trunk@321017 --- .../Process/gdb-remote/GDBRemoteCommunication.cpp | 46 +++++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp') diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 0c4df7e3f306..949cf19db658 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -600,10 +600,9 @@ bool GDBRemoteCommunication::DecompressPacket() { #if defined(HAVE_LIBCOMPRESSION) // libcompression is weak linked so check that compression_decode_buffer() is // available - if (compression_decode_buffer != NULL && - (m_compression_type == CompressionType::ZlibDeflate || - m_compression_type == CompressionType::LZFSE || - m_compression_type == CompressionType::LZ4)) { + if (m_compression_type == CompressionType::ZlibDeflate || + m_compression_type == CompressionType::LZFSE || + m_compression_type == CompressionType::LZ4) { compression_algorithm compression_type; if (m_compression_type == CompressionType::LZFSE) compression_type = COMPRESSION_LZFSE; @@ -815,7 +814,8 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len, // checksum if (m_bytes[0] == '$' && total_length > 4) { for (size_t i = 0; !binary && i < total_length; ++i) { - if (isprint(m_bytes[i]) == 0 && isspace(m_bytes[i]) == 0) { + unsigned char c = m_bytes[i]; + if (isprint(c) == 0 && isspace(c) == 0) { binary = true; } } @@ -1375,3 +1375,39 @@ void GDBRemoteCommunication::AppendBytesToCache(const uint8_t *bytes, } } } + +void llvm::format_provider::format( + const GDBRemoteCommunication::PacketResult &result, raw_ostream &Stream, + StringRef Style) { + using PacketResult = GDBRemoteCommunication::PacketResult; + + switch (result) { + case PacketResult::Success: + Stream << "Success"; + break; + case PacketResult::ErrorSendFailed: + Stream << "ErrorSendFailed"; + break; + case PacketResult::ErrorSendAck: + Stream << "ErrorSendAck"; + break; + case PacketResult::ErrorReplyFailed: + Stream << "ErrorReplyFailed"; + break; + case PacketResult::ErrorReplyTimeout: + Stream << "ErrorReplyTimeout"; + break; + case PacketResult::ErrorReplyInvalid: + Stream << "ErrorReplyInvalid"; + break; + case PacketResult::ErrorReplyAck: + Stream << "ErrorReplyAck"; + break; + case PacketResult::ErrorDisconnected: + Stream << "ErrorDisconnected"; + break; + case PacketResult::ErrorNoSequenceLock: + Stream << "ErrorNoSequenceLock"; + break; + } +} -- cgit v1.2.3