diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -689,7 +689,7 @@ const size_t bytes_len = m_bytes.size(); bool done = false; uint32_t idx; - for (idx = 1; !done && idx < bytes_len; ++idx) { + for (idx = 1; !done && idx < bytes_len;) { switch (m_bytes[idx]) { case '+': case '-': @@ -700,12 +700,13 @@ break; default: + ++idx; break; } } LLDB_LOGF(log, "GDBRemoteCommunication::%s tossing %u junk bytes: '%.*s'", - __FUNCTION__, idx - 1, idx - 1, m_bytes.c_str()); - m_bytes.erase(0, idx - 1); + __FUNCTION__, idx, idx, m_bytes.c_str()); + m_bytes.erase(0, idx); } break; }