[Lldb-commits] [lldb] [lldb] Ignore notification packets (PR #204788)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 19 02:35:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Tim Hutt (Timmmm)

<details>
<summary>Changes</summary>

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.

Fixes #<!-- -->197944 

---
Full diff: https://github.com/llvm/llvm-project/pull/204788.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (+3-2) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/204788


More information about the lldb-commits mailing list