[Lldb-commits] [lldb] r201874 - Add support for the qSpeedTest packet so we can test packet speeds and data throughput.
Greg Clayton
gclayton at apple.com
Fri Feb 21 11:08:33 PST 2014
Author: gclayton
Date: Fri Feb 21 13:08:33 2014
New Revision: 201874
URL: http://llvm.org/viewvc/llvm-project?rev=201874&view=rev
Log:
Add support for the qSpeedTest packet so we can test packet speeds and data throughput.
Modified:
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=201874&r1=201873&r2=201874&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Feb 21 13:08:33 2014
@@ -197,7 +197,7 @@ RNBRemote::CreatePacketTable ()
t.push_back (Packet (get_profile_data, &RNBRemote::HandlePacket_GetProfileData, NULL, "qGetProfileData", "Return profiling data of the current target."));
t.push_back (Packet (set_enable_profiling, &RNBRemote::HandlePacket_SetEnableAsyncProfiling, NULL, "QSetEnableAsyncProfiling", "Enable or disable the profiling of current target."));
t.push_back (Packet (watchpoint_support_info, &RNBRemote::HandlePacket_WatchpointSupportInfo, NULL, "qWatchpointSupportInfo", "Return the number of supported hardware watchpoints"));
-
+ t.push_back (Packet (speed_test, &RNBRemote::HandlePacket_qSpeedTest, NULL, "qSpeedTest:", "Test the maximum speed at which packet can be sent/received."));
}
@@ -3506,6 +3506,29 @@ RNBRemote::HandlePacket_SetEnableAsyncPr
return SendPacket ("OK");
}
+
+rnb_err_t
+RNBRemote::HandlePacket_qSpeedTest (const char *p)
+{
+ p += strlen ("qSpeedTest:response_size:");
+ char *end = NULL;
+ errno = 0;
+ uint64_t response_size = ::strtoul (p, &end, 16);
+ if (errno != 0)
+ return HandlePacket_ILLFORMED (__FILE__, __LINE__, p, "Didn't find response_size value at right offset");
+ else if (*end == ';')
+ {
+ static char g_data[4*1024*1024+16] = "data:";
+ memset(g_data + 5, 'a', response_size);
+ g_data[response_size + 5] = '\0';
+ return SendPacket (g_data);
+ }
+ else
+ {
+ return SendPacket ("E79");
+ }
+}
+
rnb_err_t
RNBRemote::HandlePacket_WatchpointSupportInfo (const char *p)
{
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.h?rev=201874&r1=201873&r2=201874&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.h Fri Feb 21 13:08:33 2014
@@ -121,7 +121,7 @@ public:
deallocate_memory, // '_m'
save_register_state, // '_g'
restore_register_state, // '_G'
-
+ speed_test, // 'qSpeedTest:'
unknown_type
} PacketEnum;
@@ -224,7 +224,7 @@ public:
rnb_err_t HandlePacket_GetProfileData(const char *p);
rnb_err_t HandlePacket_SetEnableAsyncProfiling(const char *p);
rnb_err_t HandlePacket_WatchpointSupportInfo (const char *p);
-
+ rnb_err_t HandlePacket_qSpeedTest (const char *p);
rnb_err_t HandlePacket_stop_process (const char *p);
rnb_err_t SendStopReplyPacketForThread (nub_thread_t tid);
More information about the lldb-commits
mailing list