Skip to content

Account for GetSyntheticValue failures#155737

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Walnut356:getsyntheticvalue
Apr 25, 2026
Merged

Account for GetSyntheticValue failures#155737
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Walnut356:getsyntheticvalue

Conversation

@Walnut356
Copy link
Copy Markdown
Contributor

GetSyntheticValue returns an invalid SBValue if no synthetic is present. That wasn't a problem before when we were attaching synthetics to every type, but it won't be the case once github.com//pull/155336 or similar lands. Additionally, codelldb subverts lldb_commands to apply similar behavior that doesn't attach synthetics to every type, so this fixes a regression there too.

Additionally, I removed 1 useless instance of GetSyntheticValue, since pointers should always be IndirectionSyntheticProvider, not DefaultSyntheticProvider.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 24, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Mark-Simulacrum

@jieyouxu jieyouxu self-assigned this Apr 25, 2026
Copy link
Copy Markdown
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
r? me @bors r+ rollup

View changes since this review

Comment thread src/etc/lldb_providers.py

def get_child_index(self, name: str) -> int:
if self.is_ptr and name == "$$dereference$$":
if name == "$$dereference$$":
Copy link
Copy Markdown
Member

@jieyouxu jieyouxu Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (non-blocking): Trying to better understand the synthethic provider relationships. Do we know why dereferences are handled I guess "directly" by DefaultSyntheticProvider, and not another *SyntheticProvider? Is it just because dereferences are very common?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultSyntheticProvider shouldnt ever encounter pointer types at all anymore, and its pointer logic was vestigial. Due to this check, all indirection should go through IndirectionSyntheticProvider.

Having an indirection provider fixes a number of issues that boil down to "none of our providers expect pointers to be passed in". Usually it's fine because LLDB propogates pointee children upwards as pointer children, but when we're doing things like inspecting the type's layout directly (e.g. enum variants) or a type's generic params, looking at the pointer type causes the logic to fail.

There's an alternative, iirc it's a flag on synthetics/summaries called lldb.eTypeOptionFrontendWantsDereference. I think it does what we want (forces only dereferenced/non-pointer entities passed to providers), but i need to test it and dig through the logic in LLDB to be sure.

$$dereference$$ is a special child name and LLDB uses it to allow operator * dereferencing and operator -> field access in the repl.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed reply

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 25, 2026

📌 Commit 84ebb22 has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 25, 2026
Rollup of 7 pull requests

Successful merges:

 - #155643 (Improve suggestion for $-prefixed fragment specifiers)
 - #154197 (Avoid redundant clone suggestions in borrowck diagnostics)
 - #154372 (Exposing Float Masks)
 - #155680 (Handle index projections in call destinations in DSE)
 - #155732 (bootstrap: Don't clone submodules unconditionally in dry-run)
 - #155737 (Account for `GetSyntheticValue` failures)
 - #155738 (Pass fields to `is_tuple_fields` instead of `SBValue` object)
@rust-bors rust-bors Bot merged commit 0c27f91 into rust-lang:main Apr 25, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants