Added a speed test to the GDBRemoteCommunicationClient and 
GDBRemoteCommunicationServer classes. This involved adding a new packet
named "qSpeedTest" which can test the speed of a packet send/response pairs
using a wide variety of send/recv packet sizes.

Added a few new connection classes: one for shared memory, and one for using
mach messages (Apple only). The mach message stuff is experimental and not 
working yet, but added so I don't lose the code. The shared memory stuff
uses pretty standard calls to setup shared memory.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128837 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index ea6842b..d6edbdd 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -117,6 +117,8 @@
         case StringExtractorGDBRemote::eServerPacketType_qGroupName:
             return Handle_qGroupName (packet);
 
+        case StringExtractorGDBRemote::eServerPacketType_qSpeedTest:
+            return Handle_qSpeedTest (packet);
         case StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode:
             return Handle_QStartNoAckMode (packet);
         }
@@ -429,6 +431,42 @@
 }
 
 bool
+GDBRemoteCommunicationServer::Handle_qSpeedTest (StringExtractorGDBRemote &packet)
+{
+    packet.SetFilePos(strlen ("qSpeedTest:"));
+
+    std::string key;
+    std::string value;
+    bool success = packet.GetNameColonValue(key, value);
+    if (success && key.compare("response_size") == 0)
+    {
+        uint32_t response_size = Args::StringToUInt32(value.c_str(), 0, 0, &success);
+        if (success)
+        {
+            if (response_size == 0)
+                return SendOKResponse();
+            StreamString response;
+            uint32_t bytes_left = response_size;
+            response.PutCString("data:");
+            while (bytes_left > 0)
+            {
+                if (bytes_left >= 26)
+                {
+                    response.PutCString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+                    bytes_left -= 26;
+                }
+                else
+                {
+                    response.Printf ("%*.*s;", bytes_left, bytes_left, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+                    bytes_left = 0;
+                }
+            }
+            return SendPacket (response);
+        }
+    }
+    return SendErrorResponse (7);
+}
+bool
 GDBRemoteCommunicationServer::Handle_QStartNoAckMode (StringExtractorGDBRemote &packet)
 {
     // Send response first before changing m_send_acks to we ack this packet