[Lldb-commits] [lldb] [lldb] Implement a statusline in LLDB (PR #121860)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 12 02:36:57 PST 2025
================
@@ -0,0 +1,46 @@
+import lldb
+import re
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+
+class TestStatusline(PExpectTest):
+ def do_setup(self):
+ # Create a target and run to a breakpoint.
+ exe = self.getBuildArtifact("a.out")
+ self.expect(
+ "target create {}".format(exe), substrs=["Current executable set to"]
+ )
+ self.expect('breakpoint set -p "Break here"', substrs=["Breakpoint 1"])
+ self.expect("run", substrs=["stop reason"])
+
+ # PExpect uses many timeouts internally and doesn't play well
+ # under ASAN on a loaded machine..
+ @skipIfAsan
+ def test(self):
+ """Basic test for the statusline.
+
+ PExpect was designed for line-oriented output so we're limited in what
+ we can test.
+ """
+ self.build()
+ self.launch(timeout=3)
+ self.do_setup()
+
+ # Change the terminal dimensions.
+ self.child.setwinsize(10, 60)
+
+ # Enable the statusline and check that we can see the target, the
+ # location and the stop reason.
+ self.child.send("set set show-statusline true\n")
----------------
labath wrote:
Can we use self.expect for this? I'm not sure what's the order of things being printed. If the status line is printed before the prompt, then you can put it into the `substrs` argument of the `expect` call. Otherwise, you can keep this expect line after it.
https://github.com/llvm/llvm-project/pull/121860
More information about the lldb-commits
mailing list