llvm-project/lldb/unittests
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
..
Breakpoint Rename Error -> Status. 2017-05-12 04:51:55 +00:00
Core [Core] Correctly handle float division in Scalar. 2018-03-27 18:37:54 +00:00
Editline Move PseudoTerminal to the lldb_private namespace 2017-12-11 10:09:14 +00:00
Expression Rename Error -> Status. 2017-05-12 04:51:55 +00:00
Host Remove ObjectFile usage from HostLinux::GetProcessInfo 2018-01-29 10:46:00 +00:00
Interpreter Add Utility/Environment class for handling... environments 2018-01-10 11:57:31 +00:00
Language More correct handling of error cases C++ name parser 2018-02-06 19:04:12 +00:00
ObjectFile Add a comment explaining how the input for GetModuleSpecifications_EarlySectionHeaders was generated 2018-02-05 18:03:02 +00:00
Platform [CMake] Update unit tests with accurate dependencies 2017-02-01 22:17:00 +00:00
Process gdb-remote: Fix checksum verification for messages with escape chars 2018-03-28 10:19:10 +00:00
ScriptInterpreter Added new API to SBStructuredData class 2017-05-29 08:25:46 +00:00
Signals Make LLDB skip server-client roundtrip for signals that don't require any actions 2017-03-07 21:34:40 +00:00
Symbol Fix memory leak in TestClangASTContext.TestRecordHasFields 2018-01-22 18:56:33 +00:00
SymbolFile Revert "[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it" 2018-01-22 11:51:56 +00:00
Target Fix a compiler warning in ModuleCacheTest.cpp, NFC 2018-02-23 23:18:27 +00:00
TestingSupport cmake + xcode: prevent gtests from using includes from project root 2017-10-03 21:20:18 +00:00
UnwindAssembly [LLDB] Initial version of PPC64 InstEmulation 2018-02-27 18:42:46 +00:00
Utility [Utility] Simplify and generalize the CleanUp helper, NFC 2018-02-23 22:08:38 +00:00
debugserver [CMake] Need to set WITH_LOCKDOWN on debugserver target 2017-09-06 20:15:43 +00:00
tools gdb-remote: Fix checksum verification for messages with escape chars 2018-03-28 10:19:10 +00:00
CMakeLists.txt [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
gtest_common.h [Windows] Remove the #include <eh.h> hack. 2017-03-03 20:21:59 +00:00