Skip to content

[lldb] Print ValueObject when GetObjectDescription fails (#152417) #11178

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

Open
wants to merge 2 commits into
base: stable/21.x
Choose a base branch
from

Conversation

kastiglione
Copy link

@kastiglione kastiglione commented Aug 15, 2025

This fixes a few bugs, effectively through a fallback to p when po fails.

The motivating bug this fixes is when an error within the compiler causes po to fail.
Previously when that happened, only its value (typically an object's address) was
printed – and problematically, no compiler diagnostics were shown. With this change,
compiler diagnostics are shown, and the object is fully printed (ie p).

Another bug this fixes is when po is used on a type that doesn't provide an object
description (such as a struct). Again, the normal ValueObject printing is used.

Additionally, this also improves how lldb handles an object description method that
fails in some way. Now an error will be shown (it wasn't before), and the value will be
printed normally.

(cherry picked from commit ae7e1b8)

rdar://134291640
rdar://134520818

@kastiglione kastiglione requested a review from a team as a code owner August 15, 2025 15:43
@kastiglione
Copy link
Author

@swift-ci test

@kastiglione kastiglione force-pushed the dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417 branch from e6ff6e7 to a9df4d9 Compare August 15, 2025 17:12
@kastiglione
Copy link
Author

@swift-ci test

@kastiglione kastiglione force-pushed the dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417 branch from a9df4d9 to 52281c1 Compare August 19, 2025 22:08
@kastiglione kastiglione changed the base branch from swift/release/6.2 to stable/21.x August 19, 2025 22:08
This fixes a few bugs, effectively through a fallback to `p` when `po` fails.

The motivating bug this fixes is when an error within the compiler causes `po` to fail.
Previously when that happened, only its value (typically an object's address) was
printed – and problematically, no compiler diagnostics were shown. With this change,
compiler diagnostics are shown, _and_ the object is fully printed (ie `p`).

Another bug this fixes is when `po` is used on a type that doesn't provide an object
description (such as a struct). Again, the normal `ValueObject` printing is used.

Additionally, this also improves how lldb handles an object description method that
fails in some way. Now an error will be shown (it wasn't before), and the value will be
printed normally.

(cherry picked from commit ae7e1b8)
@kastiglione kastiglione force-pushed the dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417 branch from 52281c1 to 12405a2 Compare August 19, 2025 22:11
@kastiglione
Copy link
Author

rebased to stable/21.x

@kastiglione
Copy link
Author

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant