Fix LLDB RSP client to decode '$O' packets incorrectly

Character with ASCII code 0 is incorrectly treated by LLDB as the end of
RSP packet. The left of the debugger server output is silently ignored.

Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12523

llvm-svn: 247908
This commit is contained in:
Dawn Perchik
2015-09-17 17:55:32 +00:00
parent 0537f41de5
commit 554a85711c
3 changed files with 21 additions and 5 deletions

View File

@@ -124,15 +124,24 @@ StringExtractor::DecodeHexU8()
//----------------------------------------------------------------------
uint8_t
StringExtractor::GetHexU8 (uint8_t fail_value, bool set_eof_on_fail)
{
GetHexU8Ex(fail_value, set_eof_on_fail);
return fail_value;
}
bool
StringExtractor::GetHexU8Ex (uint8_t& ch, bool set_eof_on_fail)
{
int byte = DecodeHexU8();
if (byte == -1)
{
if (set_eof_on_fail || m_index >= m_packet.size())
m_index = UINT64_MAX;
return fail_value;
// ch should not be changed in case of failure
return false;
}
return (uint8_t)byte;
ch = (uint8_t)byte;
return true;
}
uint32_t