diff options
author | Pavel Labath <labath@google.com> | 2018-03-04 02:12:18 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-03-04 02:12:18 +0000 |
commit | cdf7a9f16d367bc4156ea53003dd1e6aa3812664 (patch) | |
tree | add214a0ed12a2c9bf502bb13cfa3c8398815525 /lldb/unittests | |
parent | a476026f704450aa1474a20a6f45594488a88f9f (diff) | |
download | bcm5719-llvm-cdf7a9f16d367bc4156ea53003dd1e6aa3812664.tar.gz bcm5719-llvm-cdf7a9f16d367bc4156ea53003dd1e6aa3812664.zip |
llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets
llvm-svn: 326671
Diffstat (limited to 'lldb/unittests')
-rw-r--r-- | lldb/unittests/tools/lldb-server/tests/MessageObjects.h | 2 | ||||
-rw-r--r-- | lldb/unittests/tools/lldb-server/tests/TestClient.cpp | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/lldb/unittests/tools/lldb-server/tests/MessageObjects.h b/lldb/unittests/tools/lldb-server/tests/MessageObjects.h index 699f42d19d8..52e0298ad42 100644 --- a/lldb/unittests/tools/lldb-server/tests/MessageObjects.h +++ b/lldb/unittests/tools/lldb-server/tests/MessageObjects.h @@ -90,7 +90,7 @@ parseRegisterValue(const lldb_private::RegisterInfo &Info, 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; diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp index 019e619e8a4..b10cf498496 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -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()); } |