https://github.com/kendalharland updated 
https://github.com/llvm/llvm-project/pull/100487

>From 29d5a57eb8cc344e1a93787fe9cb333761923927 Mon Sep 17 00:00:00 2001
From: kendal <kendal@thebrowser.company>
Date: Tue, 23 Jul 2024 10:24:24 -0700
Subject: [PATCH 1/2] [lldb][test][x86_64][win] Split TestBreakpointConditions
 assertion to clarify failure message

When this test fails we see an assertion error `False != True`
This clarifies the error by showing, for example, if `1 != 3` when
comparing `var` to the string "3".
---
 .../breakpoint_conditions/TestBreakpointConditions.py     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index 50ba0317fd094..4e7a8ccb9fbeb 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -176,11 +176,15 @@ def breakpoint_conditions_python(self):
             thread.IsValid(),
             "There should be a thread stopped due to breakpoint condition",
         )
+
         frame0 = thread.GetFrameAtIndex(0)
         var = frame0.FindValue("val", lldb.eValueTypeVariableArgument)
-        self.assertTrue(
-            frame0.GetLineEntry().GetLine() == self.line1 and var.GetValue() 
== "3"
+        self.assertEqual(
+            frame0.GetLineEntry().GetLine(),
+            self.line1,
+            "The debugger stopped on the correct line",
         )
+        self.assertEqual(var.GetValue(), "3")
 
         # The hit count for the breakpoint should be 1.
         self.assertEqual(breakpoint.GetHitCount(), 1)

>From 25240b86822a3582d843a482fef16322f2fd7528 Mon Sep 17 00:00:00 2001
From: kendal <kendal@thebrowser.company>
Date: Tue, 23 Jul 2024 10:47:26 -0700
Subject: [PATCH 2/2] [lldb][test][x86_64][win] TestBreakpointConditions set
 condition on breakpoint instead of location

On windows x86_64 this test stops on the set breakpoint
when val == 1 when the breakpoint condition is set on the
SBBreakpointLocation rather than the SBBreakpoint directly.
Setting the condition on the breakpoint itself, seems to fix the issue.

This PR also splits the test assertion that verifies we're
on the correct line and have the correct value of val to make the
error message more clear. At present it just shows Assertion error: True != 
False
---
 .../TestBreakpointConditions.py               | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index 4e7a8ccb9fbeb..d202c82ea12a1 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -21,6 +21,17 @@ def test_breakpoint_condition_inline_and_run_command(self):
 
     @add_test_categories(["pyapi"])
     def test_breakpoint_condition_and_python_api(self):
+        """Use Python APIs to set breakpoint conditions."""
+        self.build()
+        self.breakpoint_conditions_python(set_breakpoint_on_location=False)
+
+    @add_test_categories(["pyapi"])
+    @expectedFailureAll(
+        oslist=["windows"],
+        archs=["x86_64"],
+        bugnumber="https://github.com/llvm/llvm-project/issues/100486";,
+    )
+    def test_breakpoint_condition_on_location_and_python_api(self):
         """Use Python APIs to set breakpoint conditions."""
         self.build()
         self.breakpoint_conditions_python()
@@ -124,7 +135,7 @@ def breakpoint_conditions(self, inline=False):
 
         self.runCmd("process kill")
 
-    def breakpoint_conditions_python(self):
+    def breakpoint_conditions_python(self, set_breakpoint_on_location=True):
         """Use Python APIs to set breakpoint conditions."""
         target = self.createTestTarget()
 
@@ -158,10 +169,14 @@ def breakpoint_conditions_python(self):
         # Get the breakpoint location from breakpoint after we verified that,
         # indeed, it has one location.
         location = breakpoint.GetLocationAtIndex(0)
-        self.assertTrue(location and location.IsEnabled(), 
VALID_BREAKPOINT_LOCATION)
 
-        # Set the condition on the breakpoint location.
-        location.SetCondition("val == 3")
+        # Set the condition.
+        if set_breakpoint_on_location:
+            location.SetCondition("val == 3")
+        else:
+            breakpoint.SetCondition("val == 3")
+
+        self.assertTrue(location and location.IsEnabled(), 
VALID_BREAKPOINT_LOCATION)
         self.expect(location.GetCondition(), exe=False, startstr="val == 3")
 
         # Now launch the process, and do not stop at entry point.

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to