summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-08-19 02:52:07 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-08-19 02:52:07 +0000
commitaef7de8492f482254b6bf8d61430ccfd5cda1199 (patch)
treeb29c4ab0bac0642c2c766488e173646c7fabcc66 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
parente8529c28f1c109e0c5f7be3ff96b17248c69b9bb (diff)
downloadbcm5719-llvm-aef7de8492f482254b6bf8d61430ccfd5cda1199.tar.gz
bcm5719-llvm-aef7de8492f482254b6bf8d61430ccfd5cda1199.zip
Add StructuredData plugin type; showcase with new DarwinLog feature
See docs/structured_data/StructuredDataPlugins.md for details. differential review: https://reviews.llvm.org/D22976 reviewers: clayborg, jingham llvm-svn: 279198
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
index 786d80176c6..fde38037d9a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
@@ -11,6 +11,7 @@
#include "llvm/ADT/StringExtras.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/LLDBAssert.h"
@@ -100,6 +101,41 @@ GDBRemoteClientBase::SendContinuePacketAndWaitForResponse(ContinueDelegate &dele
case 'A':
delegate.HandleAsyncMisc(llvm::StringRef(response.GetStringRef()).substr(1));
break;
+
+ case 'J':
+ // Asynchronous JSON packet, destined for a
+ // StructuredDataPlugin.
+ {
+ // Parse the content into a StructuredData instance.
+ auto payload_index = strlen("JSON-async:");
+ StructuredData::ObjectSP json_sp =
+ StructuredData::ParseJSON(response.GetStringRef()
+ .substr(payload_index));
+ if (log)
+ {
+ if (json_sp)
+ log->Printf(
+ "GDBRemoteCommmunicationClientBase::%s() "
+ "received Async StructuredData packet: %s",
+ __FUNCTION__,
+ response.GetStringRef().
+ substr(payload_index).c_str());
+ else
+ log->Printf("GDBRemoteCommmunicationClientBase::%s"
+ "() received StructuredData packet:"
+ " parse failure", __FUNCTION__);
+ }
+
+ // Pass the data to the process to route to the
+ // appropriate plugin. The plugin controls what happens
+ // to it from there.
+ bool routed = delegate.HandleAsyncStructuredData(json_sp);
+ if (log)
+ log->Printf("GDBRemoteCommmunicationClientBase::%s()"
+ " packet %s", __FUNCTION__,
+ routed ? "handled" : "not handled");
+ break;
+ }
case 'T':
case 'S':
// Do this with the continue lock held.
OpenPOWER on IntegriCloud