[Lldb-commits] [lldb] r326671 - llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Sat Mar 3 18:12:18 PST 2018


Author: labath
Date: Sat Mar  3 18:12:18 2018
New Revision: 326671

URL: http://llvm.org/viewvc/llvm-project?rev=326671&view=rev
Log:
llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets

Modified:
    lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
    lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp

Modified: lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h?rev=326671&r1=326670&r2=326671&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.h Sat Mar  3 18:12:18 2018
@@ -90,7 +90,7 @@ parseRegisterValue(const lldb_private::R
                    llvm::StringRef HexValue, llvm::support::endianness Endian,
                    bool ZeroPad = false);
 
-class StopReply {
+class StopReply : public Parser<std::unique_ptr<StopReply>> {
 public:
   StopReply() = default;
   virtual ~StopReply() = default;

Modified: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp?rev=326671&r1=326670&r2=326671&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp Sat Mar  3 18:12:18 2018
@@ -235,23 +235,20 @@ Error TestClient::queryProcess() {
 Error TestClient::Continue(StringRef message) {
   assert(m_process_info.hasValue());
 
-  std::string response;
-  if (Error E = SendMessage(message, response))
-    return E;
-  auto creation = StopReply::create(response, m_process_info->GetEndian(),
-                                    m_register_infos);
-  if (Error E = creation.takeError())
-    return E;
+  auto StopReplyOr = SendMessage<StopReply>(
+      message, m_process_info->GetEndian(), m_register_infos);
+  if (!StopReplyOr)
+    return StopReplyOr.takeError();
 
-  m_stop_reply = std::move(*creation);
+  m_stop_reply = std::move(*StopReplyOr);
   if (!isa<StopReplyStop>(m_stop_reply)) {
     StringExtractorGDBRemote R;
     PacketResult result = ReadPacket(R, GetPacketTimeout(), false);
     if (result != PacketResult::ErrorDisconnected) {
       return make_error<StringError>(
-          formatv("Expected connection close after receiving {0}. Got {1}/{2} "
+          formatv("Expected connection close after sending {0}. Got {1}/{2} "
                   "instead.",
-                  response, result, R.GetStringRef())
+                  message, result, R.GetStringRef())
               .str(),
           inconvertibleErrorCode());
     }




More information about the lldb-commits mailing list