[Lldb-commits] [PATCH] D126655: [lldb] [gdb-remote] Be more explicit about notification reading

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 30 07:55:06 PDT 2022


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

The current GDBRemoteCommunication::ReadPacket() support
for notifications is very limited.  Notably, it can return notifications
when the caller does not expect them and it does not provide an explicit
API to distinguish them from standard packets.  This is not a major
problem right now, as we force serialization when running in non-stop
mode and can predict when we expect notifications to arrive.

Firstly, add an explicit 'allow_notification' parameter to ReadPacket()
and WaitForPacketNoLock().  When it is false (the default),
notifications are pushed onto a queue rather than returned
to the caller.  Effectively, the existing callers can now safely expect
the reading functions to return only standard responses,
and the non-stop logic can explicitly permit notifications.

Secondly, add an explicit PacketResult value for notifications.  This
value can only be returned when allow_notification is true, so it does
not require changes for most of the callers.  For the few that support
notifications, it makes it possible to distinguish standard packets
from notification packets.

Update the non-stop client code to take advantage of the new API,
and therefore be more strict when dealing with responses in non-stop
protocol mode.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D126655

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126655.432922.patch
Type: text/x-patch
Size: 8933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220530/4253edbd/attachment.bin>


More information about the lldb-commits mailing list