diff options
author | Greg Clayton <gclayton@apple.com> | 2011-03-22 04:00:09 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-03-22 04:00:09 +0000 |
commit | 576d8834fe41bf73802832e7ac204b98455bfe25 (patch) | |
tree | 1dca2525b98563838acf8ea1445b9c316f2b162d /lldb/source/Utility/StringExtractorGDBRemote.cpp | |
parent | 27cfcbac82cc1c840571f0edf1c8675787f5db64 (diff) | |
download | bcm5719-llvm-576d8834fe41bf73802832e7ac204b98455bfe25.tar.gz bcm5719-llvm-576d8834fe41bf73802832e7ac204b98455bfe25.zip |
Split the GDBRemoteCommunication class into three classes:
GDBRemoteCommunication - The base GDB remote communication class
GDBRemoteCommunicationClient - designed to be used for clients the connect to
a remote GDB server
GDBRemoteCommunicationServer - designed to be used on the server side of a
GDB server implementation.
llvm-svn: 128070
Diffstat (limited to 'lldb/source/Utility/StringExtractorGDBRemote.cpp')
-rw-r--r-- | lldb/source/Utility/StringExtractorGDBRemote.cpp | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp index 59d00aac817..fc64b275e55 100644 --- a/lldb/source/Utility/StringExtractorGDBRemote.cpp +++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp @@ -16,8 +16,8 @@ -StringExtractorGDBRemote::Type -StringExtractorGDBRemote::GetType () const +StringExtractorGDBRemote::ResponseType +StringExtractorGDBRemote::GetResponseType () const { if (m_packet.empty()) return eUnsupported; @@ -49,29 +49,57 @@ StringExtractorGDBRemote::GetType () const return eResponse; } +StringExtractorGDBRemote::ServerPacketType +StringExtractorGDBRemote::GetServerPacketType () const +{ + // Empty is not a supported packet... + if (m_packet.empty()) + return eServerPacketType_invalid; + + const char *packet_cstr = m_packet.c_str(); + switch (m_packet[0]) + { + case '-': + if (m_packet.size() == 1) + return eServerPacketType_nack; + break; + + case '+': + if (m_packet.size() == 1) + return eServerPacketType_ack; + break; + + case 'q': + if (strcmp (packet_cstr, "qHostInfo") == 0) + return eServerPacketType_qHostInfo; + break; + } + return eServerPacketType_unimplemented; +} + bool -StringExtractorGDBRemote::IsOKPacket() const +StringExtractorGDBRemote::IsOKResponse() const { - return GetType () == eOK; + return GetResponseType () == eOK; } bool -StringExtractorGDBRemote::IsUnsupportedPacket() const +StringExtractorGDBRemote::IsUnsupportedResponse() const { - return GetType () == eUnsupported; + return GetResponseType () == eUnsupported; } bool -StringExtractorGDBRemote::IsNormalPacket() const +StringExtractorGDBRemote::IsNormalResponse() const { - return GetType () == eResponse; + return GetResponseType () == eResponse; } bool -StringExtractorGDBRemote::IsErrorPacket() const +StringExtractorGDBRemote::IsErrorResponse() const { - return GetType () == eError && + return GetResponseType () == eError && m_packet.size() == 3 && isxdigit(m_packet[1]) && isxdigit(m_packet[2]); @@ -80,7 +108,7 @@ StringExtractorGDBRemote::IsErrorPacket() const uint8_t StringExtractorGDBRemote::GetError () { - if (GetType() == eError) + if (GetResponseType() == eError) { SetFilePos(1); return GetHexU8(255); |