Skip to content

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

Merged
kastiglione merged 2 commits into
stable/21.xfrom
dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417
Sep 17, 2025
Merged

[lldb] Print ValueObject when GetObjectDescription fails (#152417)#11178
kastiglione merged 2 commits into
stable/21.xfrom
dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417

Conversation

@kastiglione

@kastiglione kastiglione commented Aug 15, 2025

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

rebased to stable/21.x

@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test

1 similar comment
@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test

@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test macOS

3 similar comments
@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test macOS

@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test macOS

@kastiglione

Copy link
Copy Markdown
Author

@swift-ci test macOS

@kastiglione kastiglione merged commit e67aa08 into stable/21.x Sep 17, 2025
1 of 3 checks passed
@kastiglione kastiglione deleted the dl/lldb-Print-ValueObject-when-GetObjectDescription-fails-152417 branch September 17, 2025 21:36
adrian-prantl pushed a commit to adrian-prantl/llvm-project that referenced this pull request Dec 12, 2025
swiftlang#11178)

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

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)

* fix TestSwiftExpressionErrorReporting

(cherry picked from commit e67aa08)
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