Skip to content

[lldb] Change the statusline format to print "no target" #10650

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

Conversation

JDevlieghere
Copy link

Cherrypicks to print "no target" in the statusline when launching lldb without a target.

Rely on operator== for std::vector instead of comparing the elements in
the vector element by element,

(cherry picked from commit a37e475)
This PR implements support for specifying multiple alternatives for
scope format entries. Scopes are used to enclose things that should only
be printed when everything in the scope resolves.

For example, the following scope only resolves if both
`${line.file.basename}` and `${line.number}` resolve. `

```
{ at ${line.file.basename}:${line.number}}
```

However, the current implementation doesn't let you specify what to
print when they don't resolve. This PR adds support for specifying
multiple alternative scopes, which are evaluated left-to-right.

For example:

```
{ at ${line.file.basename}:${line.number}| in ${function.name}| <unknown location>}
```

This will resolve to:

- ` at ${line.file.basename}:${line.number}` if the corresponding
variables resolve.
- Otherwise, this resolves to ` in ${function.name}` if
`${function.name}` resolves.
- Otherwise, this resolves to ` <unknown location>` which always
resolves.

This PR makes the `|` character a special character within a scope, but
allows it to be escaped.

I ended up with this approach because it fit quite nicely in the
existing architecture of the format entries and by limiting the
functionality to scopes, it sidesteps some complexity, like dealing with
recursion.

(cherry picked from commit 3e235a7)
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)
@JDevlieghere JDevlieghere requested a review from adrian-prantl May 8, 2025 17:01
@JDevlieghere JDevlieghere requested a review from a team as a code owner May 8, 2025 17:01
@JDevlieghere
Copy link
Author

@swift-ci test

@JDevlieghere JDevlieghere merged commit e416887 into swift/release/6.2 May 8, 2025
3 checks passed
@JDevlieghere JDevlieghere deleted the cherrypick-swift/release/6.2-a37e475efc22-3e235a7c601d-45cd708184e1 branch May 8, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants