llvm-project/lldb/source
Pavel Labath 5a84123490 gdb-remote: Fix checksum verification for messages with escape chars
Summary:
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.

Reviewers: clayborg, jasonmolenda

Subscribers: mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D44922

llvm-svn: 328693
2018-03-28 10:19:10 +00:00
..
API Add a missing return in SBPlatform::IsConnected and test 2018-03-13 21:06:05 +00:00
Breakpoint Re-add change for https://reviews.llvm.org/D42582 with added directories. 2018-03-12 21:17:04 +00:00
Commands [Commands] Add a (currently empty) `stats` command. 2018-03-23 21:55:48 +00:00
Core [Core] Correctly handle float division in Scalar. 2018-03-27 18:37:54 +00:00
DataFormatters Use exact equality for category language matching, for all languages, except those specifically mentioned. 2017-06-06 20:40:24 +00:00
Expression Move the codebase to use: DWARFCompileUnit -> DWARFUnit 2018-03-18 20:11:02 +00:00
Host Re-land: [lldb] Use vFlash commands when writing to target's flash memory regions 2018-03-20 11:56:24 +00:00
Initialization Don't use llvm::EnablePrettyStackTrace on macOS. 2017-12-02 00:11:18 +00:00
Interpreter [Commands] Add a (currently empty) `stats` command. 2018-03-23 21:55:48 +00:00
Plugins gdb-remote: Fix checksum verification for messages with escape chars 2018-03-28 10:19:10 +00:00
Symbol Use the DWARF linkage name when importing C++ methods. 2018-03-27 19:40:50 +00:00
Target Re-land: [lldb] Use vFlash commands when writing to target's flash memory regions 2018-03-20 11:56:24 +00:00
Utility Move StringExtractorGDBRemote.h to the include folder 2018-03-20 16:14:00 +00:00
CMakeLists.txt Remove Plugins/Process/POSIX from include_directories 2017-04-11 12:26:25 +00:00
lldb.cpp Run clang-format on lldb.cpp 2017-11-02 16:56:52 +00:00