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.





git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128070 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Utility/StringExtractorGDBRemote.cpp b/source/Utility/StringExtractorGDBRemote.cpp
index 59d00aa..fc64b27 100644
--- a/source/Utility/StringExtractorGDBRemote.cpp
+++ b/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 @@
     return eResponse;
 }
 
-bool
-StringExtractorGDBRemote::IsOKPacket() const
+StringExtractorGDBRemote::ServerPacketType
+StringExtractorGDBRemote::GetServerPacketType () const
 {
-    return GetType () == eOK;
+    // 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::IsOKResponse() const
+{
+    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 @@
 uint8_t
 StringExtractorGDBRemote::GetError ()
 {
-    if (GetType() == eError)
+    if (GetResponseType() == eError)
     {
         SetFilePos(1);
         return GetHexU8(255);