[Lldb-commits] [PATCH] D116009: [lldb/gdb-remote] drop all junk bytes in incoming packet
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 19 18:09:04 PST 2021
clayborg added inline comments.
================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:689-706
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 '-':
----------------
This might be more easily and cleanly done with:
```
const 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/D116009/new/
https://reviews.llvm.org/D116009
More information about the lldb-commits
mailing list