[Lldb-commits] [lldb] [LLDB]Fix logic in matches method for thread comparison (PR #179873)

Priyanshu Kumar via lldb-commits lldb-commits at lists.llvm.org
Sat Feb 14 07:23:13 PST 2026


https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/179873

>From 2ed013156a86dc735e13fe72ba55eaa105a698ae Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Thu, 5 Feb 2026 12:28:46 +0530
Subject: [PATCH 1/3] Update TestDAP_stopped_events.py

---
 .../API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
index 03dff39c82ed9..06d58fc6ff97d 100644
--- a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
+++ b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
@@ -16,7 +16,7 @@ class TestDAP_stopped_events(lldbdap_testcase.DAPTestCaseBase):
 
     def matches(self, a: dict, b: dict) -> bool:
         """Returns true if 'a' is a subset of 'b', otherwise false."""
-        return a | b == a
+        return b | a == b
 
     def verify_threads(self, expected_threads):
         threads_resp = self.dap_server.request_threads()

>From 19d097e300d6a49f85422129e30dc19034547b78 Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Thu, 5 Feb 2026 12:47:01 +0530
Subject: [PATCH 2/3] Update comment

---
 .../tools/lldb-dap/stopped-events/TestDAP_stopped_events.py   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
index 06d58fc6ff97d..0389fa1f00016 100644
--- a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
+++ b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
@@ -15,8 +15,8 @@ class TestDAP_stopped_events(lldbdap_testcase.DAPTestCaseBase):
     ANY_THREAD = {}
 
     def matches(self, a: dict, b: dict) -> bool:
-        """Returns true if 'a' is a subset of 'b', otherwise false."""
-        return b | a == b
+        """Returns true if 'b' is a subset of 'a', otherwise false."""
+        return a | b == a
 
     def verify_threads(self, expected_threads):
         threads_resp = self.dap_server.request_threads()

>From fbada7ed2ebbb6fe55f644811255fd591ebedd47 Mon Sep 17 00:00:00 2001
From: Priyanshu Kumar <10b.priyanshu at gmail.com>
Date: Sat, 14 Feb 2026 20:51:23 +0530
Subject: [PATCH 3/3] Rename method and parameter's names

---
 .../lldb-dap/stopped-events/TestDAP_stopped_events.py     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
index 0389fa1f00016..a9775c6deba53 100644
--- a/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
+++ b/lldb/test/API/tools/lldb-dap/stopped-events/TestDAP_stopped_events.py
@@ -14,9 +14,9 @@ class TestDAP_stopped_events(lldbdap_testcase.DAPTestCaseBase):
 
     ANY_THREAD = {}
 
-    def matches(self, a: dict, b: dict) -> bool:
-        """Returns true if 'b' is a subset of 'a', otherwise false."""
-        return a | b == a
+    def is_subdict(self, small: dict, big: dict) -> bool:
+        """Returns true if 'small' is a subset of 'big', otherwise false."""
+        return big | small == big
 
     def verify_threads(self, expected_threads):
         threads_resp = self.dap_server.request_threads()
@@ -26,7 +26,7 @@ def verify_threads(self, expected_threads):
         for idx, expected_thread in enumerate(expected_threads):
             thread = threads[idx]
             self.assertTrue(
-                self.matches(thread, expected_thread),
+                self.is_subdict(thread, expected_thread),
                 f"Invalid thread state in {threads_resp}",
             )
 



More information about the lldb-commits mailing list