Index: lldb/trunk/include/lldb/Utility/StringExtractor.h =================================================================== --- lldb/trunk/include/lldb/Utility/StringExtractor.h +++ lldb/trunk/include/lldb/Utility/StringExtractor.h @@ -115,6 +115,9 @@ GetHexU8 (uint8_t fail_value = 0, bool set_eof_on_fail = true); bool + GetHexU8Ex (uint8_t& ch, bool set_eof_on_fail = true); + + bool GetNameColonValue (std::string &name, std::string &value); int32_t Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1262,9 +1262,13 @@ got_async_packet = true; std::string inferior_stdout; inferior_stdout.reserve(response.GetBytesLeft () / 2); - char ch; - while ((ch = response.GetHexU8()) != '\0') - inferior_stdout.append(1, ch); + + uint8_t ch; + while (response.GetHexU8Ex(ch)) + { + if (ch != 0) + inferior_stdout.append(1, (char)ch); + } process->AppendSTDOUT (inferior_stdout.c_str(), inferior_stdout.size()); } break; Index: lldb/trunk/source/Utility/StringExtractor.cpp =================================================================== --- lldb/trunk/source/Utility/StringExtractor.cpp +++ lldb/trunk/source/Utility/StringExtractor.cpp @@ -125,14 +125,23 @@ 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