[Lldb-commits] [PATCH] D131094: [lldb] [gdb-remote] Support reading notification packets

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 3 12:38:40 PDT 2022


mgorny created this revision.
mgorny added reviewers: labath, emaste, jingham, krytarowski.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Add explicit support for reading (or skipping) notification packets
to GDBRemoteCommunication::ReadPacket().  Previously, the code would not
really distinguish between regular replies and notifications,
and would return the next packet to the caller without even a clear
indication whether it is a regular or notification packet.

Since the majority of existing call sites do not expect to read
notifications, add a new "allow_notification" parameter that defaults to
false.  If it is false, then any notifications received from the server
are stashed onto a queue and the function waits for a regular reply
instead.  If it is true, then the function either returns the first
notification queued previously or waits for any packet (either regular
or notification).

To make it possible to clearly distinguish between regular
and notification packets, add a new PacketResult::Notify.  It is used
in lieu of PacketResult::Success when a notification packet is read.
While admittedly this is not the cleanest possible solution, it requires
minimal changes to the existing code.  In the end, we expect only a few
call sites to actually expect and read notifications.

Split from the non-stop protocol support in D126614 <https://reviews.llvm.org/D126614>.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D131094

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131094.449743.patch
Type: text/x-patch
Size: 8839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220803/0d01dc74/attachment.bin>


More information about the lldb-commits mailing list