[Lldb-commits] [lldb] [lldb] Ignore notification packets (PR #204788)
Tim Hutt via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 19 02:34:20 PDT 2026
https://github.com/Timmmm created https://github.com/llvm/llvm-project/pull/204788
The gdb-protocol spec says
> Recipients should silently ignore corrupted notifications and notifications they do not understand.
This changes `WaitForPacketNoLock` so that it ignores all notifications (I'm not sure about corrupted ones).
An example of a notification that causes issues without this change is that OpenOCD sends `%ookeepalive:00` notifications during memory accesses.
>From 3bd9af82fe7216aefa5451731a70ec63b284aaf7 Mon Sep 17 00:00:00 2001
From: Tim Hutt <tdhutt at gmail.com>
Date: Mon, 18 May 2026 10:22:54 +0100
Subject: [PATCH] [lldb] Ignore notification packets
The gdb-protocol spec says
> Recipients should silently ignore corrupted notifications and notifications they do not understand.
This changes `WaitForPacketNoLock` so that it ignores all notifications (I'm not sure about corrupted ones).
An example of a notification that causes issues without this change is that OpenOCD sends `%ookeepalive:00` notifications during memory accesses.
---
.../Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 04f486882e2c2..ecc73cce77a61 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -242,7 +242,8 @@ GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet,
Log *log = GetLog(GDBRLog::Packets);
// Check for a packet from our cache first without trying any reading...
- if (CheckForPacket(nullptr, 0, packet) != PacketType::Invalid)
+ // No notifications are currently supported so they should be ignored.
+ if (CheckForPacket(nullptr, 0, packet) == PacketType::Standard)
return PacketResult::Success;
bool timed_out = false;
@@ -258,7 +259,7 @@ GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet,
error, bytes_read);
if (bytes_read > 0) {
- if (CheckForPacket(buffer, bytes_read, packet) != PacketType::Invalid)
+ if (CheckForPacket(buffer, bytes_read, packet) == PacketType::Standard)
return PacketResult::Success;
} else {
switch (status) {
More information about the lldb-commits
mailing list