summaryrefslogtreecommitdiff
path: root/lldb/source/Utility/StringExtractor.cpp
diff options
context:
space:
mode:
authorDawn Perchik <dawn@burble.org>2015-09-17 17:55:32 +0000
committerDawn Perchik <dawn@burble.org>2015-09-17 17:55:32 +0000
commit554a85711cd9726411660fed7bc825ae77fbe94e (patch)
tree3a1d51dc32ccc84efe980c66e111e992fc937ed5 /lldb/source/Utility/StringExtractor.cpp
parent0537f41de5666d2632468462327f800734f49940 (diff)
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
Diffstat (limited to 'lldb/source/Utility/StringExtractor.cpp')
-rw-r--r--lldb/source/Utility/StringExtractor.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/Utility/StringExtractor.cpp b/lldb/source/Utility/StringExtractor.cpp
index 6302c033c0c1..e135531d6a4a 100644
--- a/lldb/source/Utility/StringExtractor.cpp
+++ b/lldb/source/Utility/StringExtractor.cpp
@@ -125,14 +125,23 @@ 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