Skip to content

[Debuginfo] improve enum value formatting in LLDB for better readability #145218

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 3 commits into
base: master
Choose a base branch
from

Conversation

nilptr
Copy link

@nilptr nilptr commented Aug 10, 2025

TL;DR: When debugging with CodeLLDB, I noticed enum values were often hard to read because LLDB lists every possible variant, resulting in a verbose and cluttered view, even though only one variant is actually valid. Interestingly, raw enum types display nicely. After some investigation, I found that &enum values get classified as Other, so it falls back to DefaultSyntheticProvider, which causes this verbose output.

What does this PR do?

This PR contains 2 commits:

  1. change the enum value formatting from showing 2 separate fields (value for attached data and $discr$ for the discriminator) to a concise <readable variant name>: <attached data> format
  2. dereference pointer types in classify_rust_type so that it can return more accurate type for reference type

Self-test proof

Before:

before

After:

after

@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2025

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 10, 2025
@rust-log-analyzer

This comment has been minimized.

@nilptr nilptr force-pushed the nilptr/feat/lldb-enum-pretty-printer branch from 81979cd to 6be749b Compare August 17, 2025 13:15
@rustbot
Copy link
Collaborator

rustbot commented Aug 17, 2025

This PR was rebased onto a different master commit! Check out the changes with our range-diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants