[Lldb-commits] [lldb] [lldb] Ignore notification packets (PR #204788)
Tim Hutt via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 19 06:29:22 PDT 2026
https://github.com/Timmmm updated https://github.com/llvm/llvm-project/pull/204788
>From de38d60e6684c2927e62144e62228a43f9236228 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.
An example of a notification that causes issues without this change is that OpenOCD sends `%ookeepalive:00` notifications during memory accesses.
---
.../gdb-remote/GDBRemoteCommunication.cpp | 22 +++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 04f486882e2c2..21da81d1136ee 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -242,8 +242,15 @@ 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)
- return PacketResult::Success;
+ switch (CheckForPacket(nullptr, 0, packet)) {
+ case PacketType::Standard:
+ return PacketResult::Success;
+ case PacketType::Invalid:
+ break;
+ case PacketType::Notify:
+ // No notifications are currently supported so they should be ignored.
+ break;
+ }
bool timed_out = false;
bool disconnected = false;
@@ -258,8 +265,15 @@ GDBRemoteCommunication::WaitForPacketNoLock(StringExtractorGDBRemote &packet,
error, bytes_read);
if (bytes_read > 0) {
- if (CheckForPacket(buffer, bytes_read, packet) != PacketType::Invalid)
- return PacketResult::Success;
+ switch (CheckForPacket(buffer, bytes_read, packet)) {
+ case PacketType::Standard:
+ return PacketResult::Success;
+ case PacketType::Invalid:
+ break;
+ case PacketType::Notify:
+ // No notifications are currently supported so they should be ignored.
+ break;
+ }
} else {
switch (status) {
case eConnectionStatusTimedOut:
More information about the lldb-commits
mailing list