llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets

llvm-svn: 326671
This commit is contained in:
Pavel Labath 2018-03-04 02:12:18 +00:00
parent a476026f70
commit cdf7a9f16d
2 changed files with 8 additions and 11 deletions

View File

@ -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;

View File

@ -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());
}