[Lldb-commits] [PATCH] D44922: gdb-remote: Fix checksum verification for messages with escape chars

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 27 05:50:36 PDT 2018


labath created this revision.
labath added reviewers: clayborg, jasonmolenda.
Herald added a subscriber: mgorny.

We've had a mismatch in the checksum computation between the sender and
receiver. The sender computed the payload checksum using the wire
encoding of the packet, while the receiver did this after expanding
un-escaping and expanding run-length-encoded sequences. This resulted in
communication breakdown if packets using these feature were sent in the
ack mode.

Normally, this did not cause any issues since the only packet we send in
the ack-mode is the QStartNoAckMode packet, but I ran into this when
debugging the lldb-server tests which (for better or worse) don't use
this mode.

According to the gdb-remote documentation "The two-digit checksum is computed as
the modulo 256 sum of all characters between the leading ‘$’ and the
trailing ‘#’", it seems that our sender is doing the right thing here.
Therefore, I fix the receiver the match the sender behavior and add a
test.

With this bug fixed, we can see that lldb-server is sending a stop-reply
after receiving the "k" in the same way as debugserver does (but we
weren't detecting this because at that point the connection was dead
already). I fix that expectation as well.


https://reviews.llvm.org/D44922

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  unittests/Process/gdb-remote/CMakeLists.txt
  unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp
  unittests/tools/lldb-server/tests/TestClient.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44922.139905.patch
Type: text/x-patch
Size: 4288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180327/d9b28cdb/attachment.bin>


More information about the lldb-commits mailing list