[Lldb-commits] [PATCH] D114520: [lldb/gdb-remote] Ignore spurious ACK packets

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 24 02:47:49 PST 2021


labath created this revision.
labath added reviewers: mgorny, jasonmolenda.
labath requested review of this revision.
Herald added a project: LLDB.

Although I cannot find any mention of this in the specification, both
gdb and lldb agree on sending an initial + packet after establishing the
connection.

OTOH, gdbserver and lldb-server behavior is subtly different. While
lldb-server *expects* the initial ack, and drops the connection if it is
not received, gdbserver will just ignore a spurious ack at _any_ point
in the connection.

This patch changes lldb's behavior to match that of gdb. An ACK packet
is ignored at any point in the connection (except when expecting an ACK
packet, of course). This is inline with the "be strict in what you
generate, and lenient in what you accept" philosophy, and also enables
us to remove some special cases from the server code. I've extended the
same handling to NAK (-) packets, mainly because I don't see a reason to
treat them differently here.

(The background here is that we had a stub which was sending spurious
+ packets. This bug has since been fixed, but I think this change makes
sense nonetheless.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114520

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/tools/lldb-server/lldb-platform.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114520.389442.patch
Type: text/x-patch
Size: 7900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211124/8f654ebb/attachment.bin>


More information about the lldb-commits mailing list