[Lldb-commits] [lldb] [lldb] Ignore async notification packets while waiting for a response (PR #202556)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 9 03:51:38 PDT 2026
================
@@ -75,6 +75,25 @@ TEST_F(GDBRemoteCommunicationTest, ReadPacket) {
}
}
+// Test that async notification packets received while waiting for a response
+// are silently dropped and that we keep looking for the actual response.
+// OpenOCD sends a "%oocd_keepalive:XX#cc" notification during long memory
+// operations; like GDB (since 7.0), LLDB must ignore it rather than mistake it
+// for the response. See https://github.com/llvm/llvm-project/issues/197944.
+TEST_F(GDBRemoteCommunicationTest, ReadPacketIgnoresNotifications) {
+ StringExtractorGDBRemote response;
+
+ // A single notification ahead of the response.
+ ASSERT_TRUE(Write("%oocd_keepalive:00#54$OK#9a"));
+ ASSERT_EQ(PacketResult::Success, client.ReadPacket(response));
+ EXPECT_EQ("OK", response.GetStringRef());
+
+ // Several notifications ahead of the response.
+ ASSERT_TRUE(Write("%oocd_keepalive:01#55%oocd_keepalive:02#56$OK#9a"));
+ ASSERT_EQ(PacketResult::Success, client.ReadPacket(response));
+ EXPECT_EQ("OK", response.GetStringRef());
+}
----------------
DavidSpickett wrote:
Add a test for when all you have is a notify. ReadPacket should just fail in that case rather than returning the notify.
https://github.com/llvm/llvm-project/pull/202556
More information about the lldb-commits
mailing list