[Lldb-commits] [PATCH] D32585: Implementation of remote packets for Trace data.

Ravitheja Addepally via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 23 03:17:18 PDT 2017


ravitheja added inline comments.


================
Comment at: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp:400
+
+  HandlePacket(server, "jTraceStart:{\"buffersize\" : 8192,\"jparams\" : {\"psb\" : 1,\"tracetech\" : \"intel-pt\"},\"metabuffersize\" : 8192,\"threadid\" : 35,\"type\" : 1}", "1");
+  ASSERT_EQ(result.get(),1);
----------------
labath wrote:
> ravitheja wrote:
> > clayborg wrote:
> > > Use the R"( so you don't have to desensitize the double quotes and so you can format nicely:
> > > 
> > > ```
> > > const char *json = R"(
> > > jTraceStart: {
> > >   "buffersize" : 8192,
> > >   "metabuffersize" : 8192,
> > >   "threadid" : 35,
> > >   "type" : 1,
> > >   "jparams" : {
> > >     "psb" : 1,
> > >     "tracetech" : "intel-pt"
> > >   }
> > > })";
> > > HandlePacket(server, json, "1");
> > > ```
> > That won't match coz the new lines and extra spaces cause mismatch in the packet string produced. Also unfortunately the Dump Function in the StrucuturedData::Dictionary adds spaces around the colons between "Key" : Value , so removing all whitespaces won't work. Now I can still add some functions to format the expexted string according to the one printed by Dump function, but that would be more code.
> I've been wanting to add make these tests smarter now that they are getting more use. I'll take a todo item here to add a smarter way to compare json fields here. For now you can at least do the R" thing Greg suggests.
Yes I can do the R thing but then i can't format it nicely, as Greg suggested.


https://reviews.llvm.org/D32585





More information about the lldb-commits mailing list