[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 5 05:23:41 PST 2024


================
@@ -0,0 +1,26 @@
+"""
+Test that disabling breakpoints and viewing them in a list uses the correct ANSI color settings when colors are enabled and disabled.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+import io
+
+
+class DisabledBreakpointsTest(PExpectTest):
+    @add_test_categories(["pexpect"])
+    def test_disabling_breakpoints_with_color(self):
+        """Test that disabling a breakpoint and viewing the breakpoints list uses the specified ANSI color prefix."""
+        ansi_red_color_code = "\x1b[31m"
+
+        self.launch(use_colors=True, dimensions=(100, 100))
+        self.expect('settings set disable-breakpoint-ansi-prefix "${ansi.fg.red}"')
+        self.expect("b main")
+        self.expect("br dis")
+        self.expect("br l")
+        self.child.expect_exact(ansi_red_color_code + "1:")
----------------
labath wrote:

```suggestion
        self.expect("br l", substrs=[ansi_red_color_code + "1:"])
```

The idea is to make this mostly look like the existing SB API tests.

Kinda surprised it works without it. If I had to guess, I'd say its because of the prompt coloring code causes the prompt substring to be present more than once (which then means the substring search loses synch).

(That's one more reason to add some sort of expectations to the previous commands. The other reason is that they give you an earlier indication if something goes wrong during the test -- the pexpect error messages aren't of the most readable type)

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


More information about the lldb-commits mailing list