summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-04-04 18:18:57 +0000
committerGreg Clayton <gclayton@apple.com>2011-04-04 18:18:57 +0000
commit9b1e1cdf231e25e50ba565bee77566949dd9a676 (patch)
treec1103c123f8b738cb29d8928c93db1d2da197dea /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
parent13ce236c4cbd9b1d2883ad78b2b8658f7638e08d (diff)
downloadbcm5719-llvm-9b1e1cdf231e25e50ba565bee77566949dd9a676.tar.gz
bcm5719-llvm-9b1e1cdf231e25e50ba565bee77566949dd9a676.zip
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. llvm-svn: 128837
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index ea6842b999a..d6edbdd6a53 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -117,6 +117,8 @@ GDBRemoteCommunicationServer::GetPacketAndSendResponse (const TimeValue* timeout
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 @@ GDBRemoteCommunicationServer::Handle_qGroupName (StringExtractorGDBRemote &packe
}
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
OpenPOWER on IntegriCloud