clayborg added inline comments.

================
Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:650-676
+    // Check if we have an unexpected byte and we need to flush all bad data
+    // that is in m_bytes, so we need to find the first byte that is a '+'
+    // (ACK), '-' (NACK), \x03 (CTRL+C interrupt), or '$' character (start of
+    // packet header) or of course, the end of the data in m_bytes...
+    const size_t bytes_len = m_bytes.size();
+    bool done = false;
+    uint32_t idx;
----------------
Might be easier to use std::string methods to do this:
```
const size_t idx = m_bytes.find_first_of("+-\x03%$");
if (idx != 0) {
      LLDB_LOGF(log, "GDBRemoteCommunication::%s tossing %u junk bytes: '%.*s'",
                __FUNCTION__, idx, idx, m_bytes.c_str());
      m_bytes.erase(0, idx);
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116006/new/

https://reviews.llvm.org/D116006

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to