-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[lldb] Change the statusline format to print "no target" #139021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Change the default statusline format to print "no target" when lldb is launched without a target. Currently, the statusline is empty, which looks rather odd.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesChange the default statusline format to print "no target" when lldb is launched without a target. Currently, the statusline is empty, which looks rather odd. Full diff: https://github.com/llvm/llvm-project/pull/139021.diff 2 Files Affected:
diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td
index 2498841b47d9f..78988ce5b732f 100644
--- a/lldb/source/Core/CoreProperties.td
+++ b/lldb/source/Core/CoreProperties.td
@@ -186,7 +186,7 @@ let Definition = "debugger" in {
: Property<"statusline-format", "FormatEntity">,
Global,
DefaultStringValue<
- "${ansi.negative}{${target.file.basename}}{ "
+ "${ansi.negative}{${target.file.basename}|no target}{ "
"${separator}${line.file.basename}:${line.number}:${line.column}}{ "
"${separator}${thread.stop-reason}}{ "
"${separator}{${progress.count} }${progress.message}}">,
diff --git a/lldb/test/API/functionalities/statusline/TestStatusline.py b/lldb/test/API/functionalities/statusline/TestStatusline.py
index da6b4e7c8f320..f00413e878d26 100644
--- a/lldb/test/API/functionalities/statusline/TestStatusline.py
+++ b/lldb/test/API/functionalities/statusline/TestStatusline.py
@@ -6,7 +6,18 @@
from lldbsuite.test.lldbpexpect import PExpectTest
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
class TestStatusline(PExpectTest):
+
+ # Change this value to something smaller to make debugging this test less
+ # tedious.
+ TIMEOUT = 60
+
+ TERMINAL_HEIGHT = 10
+ TERMINAL_WIDTH = 60
+
def do_setup(self):
# Create a target and run to a breakpoint.
exe = self.getBuildArtifact("a.out")
@@ -15,36 +26,34 @@ def do_setup(self):
)
self.expect('breakpoint set -p "Break here"', substrs=["Breakpoint 1"])
self.expect("run", substrs=["stop reason"])
+ self.resize()
+
+ def resize(self):
+ # Change the terminal dimensions. When we launch the tests, we reset
+ # all the settings, leaving the terminal dimensions unset.
+ self.child.setwinsize(self.TERMINAL_HEIGHT, self.TERMINAL_WIDTH)
- # 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."""
self.build()
- self.launch()
+ self.launch(timeout=self.TIMEOUT)
self.do_setup()
- # Change the terminal dimensions.
- terminal_height = 10
- terminal_width = 60
- self.child.setwinsize(terminal_height, terminal_width)
-
# Enable the statusline and check for the control character and that we
# can see the target, the location and the stop reason.
self.expect('set set separator "| "')
self.expect(
"set set show-statusline true",
[
- "\x1b[0;{}r".format(terminal_height - 1),
+ "\x1b[0;{}r".format(self.TERMINAL_HEIGHT - 1),
"a.out | main.c:2:11 | breakpoint 1.1 ",
],
)
# Change the terminal dimensions and make sure it's reflected immediately.
- self.child.setwinsize(terminal_height, 25)
+ self.child.setwinsize(self.TERMINAL_HEIGHT, 25)
self.child.expect(re.escape("a.out | main.c:2:11 | bre"))
- self.child.setwinsize(terminal_height, terminal_width)
+ self.child.setwinsize(self.TERMINAL_HEIGHT, self.TERMINAL_WIDTH)
# Change the separator.
self.expect('set set separator "S "', ["a.out S main.c:2:11"])
@@ -58,23 +67,15 @@ def test(self):
# Hide the statusline and check or the control character.
self.expect(
- "set set show-statusline false", ["\x1b[0;{}r".format(terminal_height)]
+ "set set show-statusline false", ["\x1b[0;{}r".format(self.TERMINAL_HEIGHT)]
)
- # PExpect uses many timeouts internally and doesn't play well
- # under ASAN on a loaded machine..
- @skipIfAsan
def test_no_color(self):
"""Basic test for the statusline with colors disabled."""
self.build()
- self.launch(use_colors=False)
+ self.launch(use_colors=False, timeout=self.TIMEOUT)
self.do_setup()
- # Change the terminal dimensions.
- terminal_height = 10
- terminal_width = 60
- self.child.setwinsize(terminal_height, terminal_width)
-
# Enable the statusline and check for the "reverse video" control character.
self.expect(
"set set show-statusline true",
@@ -87,15 +88,20 @@ def test_deadlock(self):
"""Regression test for lock inversion between the statusline mutex and
the output mutex."""
self.build()
- self.launch(extra_args=["-o", "settings set use-color false"])
+ self.launch(
+ extra_args=["-o", "settings set use-color false"], timeout=self.TIMEOUT
+ )
self.child.expect("(lldb)")
-
- # Change the terminal dimensions.
- terminal_height = 10
- terminal_width = 60
- self.child.setwinsize(terminal_height, terminal_width)
+ self.resize()
exe = self.getBuildArtifact("a.out")
self.expect("file {}".format(exe), ["Current executable"])
self.expect("help", ["Debugger commands"])
+
+ def test_no_target(self):
+ """Test that we print "no target" when launched without a target."""
+ self.launch(timeout=self.TIMEOUT)
+ self.resize()
+
+ self.expect("set set show-statusline true", ["no target"])
|
✅ With the latest revision this PR passed the Python code formatter. |
Michael137
approved these changes
May 8, 2025
JDevlieghere
added a commit
to swiftlang/llvm-project
that referenced
this pull request
May 8, 2025
Change the default statusline format to print "no target" when lldb is launched without a target. Currently, the statusline is empty, which looks rather odd. (cherry picked from commit 45cd708)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change the default statusline format to print "no target" when lldb is launched without a target. Currently, the statusline is empty, which looks rather odd.