Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -411,10 +411,12 @@ // it off with an invalid value that is the same as the current // index. size_t content_start = 0; - size_t content_length = 0; + size_t content_length = std::string::npos; size_t total_length = 0; size_t checksum_idx = std::string::npos; + while (!m_bytes.empty() && content_length == std::string::npos) + { switch (m_bytes[0]) { case '+': // Look for ack @@ -475,11 +477,12 @@ } if (log) log->Printf ("GDBRemoteCommunication::%s tossing %u junk bytes: '%.*s'", - __FUNCTION__, idx, idx, m_bytes.c_str()); - m_bytes.erase(0, idx); + __FUNCTION__, idx - 1, idx - 1, m_bytes.c_str()); + m_bytes.erase(0, idx - 1); } break; } + } if (content_length == std::string::npos) {