rust/tests/debuginfo
Jacob Pratt 5cfdbd6c08
Rollup merge of #145218 - nilptr:nilptr/feat/lldb-enum-pretty-printer, r=Mark-Simulacrum
[Debuginfo] improve enum value formatting in LLDB for better readability

> 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:

<img width="1706" height="799" alt="before" src="https://github.com/user-attachments/assets/b66c7e22-990a-4da5-9036-34e3f9f62367" />

After:

<img width="1541" height="678" alt="after" src="https://github.com/user-attachments/assets/36db32e2-f822-4883-8f17-cb8067e509f6" />
2025-08-22 22:00:49 -04:00
..
auxiliary Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
associated-types.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
basic-stepping.rs tests: Add test for basic line-by-line stepping in a debugger 2025-07-26 13:06:21 +02:00
basic-types-globals-metadata.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
basic-types-globals.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
basic-types-metadata.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
basic-types-mut-globals.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
basic-types.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
borrowed-basic.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
borrowed-c-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
borrowed-enum.rs feat(lldb debug info): improve enum value formatting in lldb 2025-08-17 21:15:18 +08:00
borrowed-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
borrowed-tuple.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
borrowed-unique-basic.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
box.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
boxed-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
by-value-non-immediate-argument.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
by-value-self-argument-in-trait-impl.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
c-style-enum-in-composite.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
c-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
captured-fields-1.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
captured-fields-2.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
closure-in-generic-function.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
closures.rs Add and improve debuginfo tests for Windows 2025-01-13 09:38:04 +01:00
collapse-debuginfo-external-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-external-flag-overriden-by-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-external-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-in-non-collapse-macro.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-no-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-static-external.rs Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
collapse-debuginfo-static.rs Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
collapse-debuginfo-with-attr-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-with-attr.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
collapse-debuginfo-with-yes-flag.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
constant-debug-locs.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
constant-in-match-pattern.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
constant-ordering-prologue.rs Update debuginfo test for newer lldb 2024-10-21 11:40:12 -07:00
coroutine-closure.rs replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
coroutine-locals.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
coroutine-objects.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
cross-crate-spans.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
cross-crate-type-uniquing.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
destructured-fn-argument.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
destructured-for-loop-variable.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
destructured-local.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
drop-locations.rs tests: refine disable reason for tests/debuginfo/drop-locations.rs 2025-04-17 18:52:57 +08:00
dummy_span.rs Add a test. 2024-08-19 17:10:43 -07:00
duration-type.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
embedded-visualizer-point.natvis Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer-point.py Reformat Python code with ruff 2024-12-04 23:03:44 +01:00
embedded-visualizer.natvis Move /src/test to /tests 2023-01-11 09:32:08 +00:00
embedded-visualizer.py Reformat Python code with ruff 2024-12-04 23:03:44 +01:00
embedded-visualizer.rs Revert "Embed GDB pretty printers in rlibs and dylibs" 2025-08-06 18:00:58 +00:00
empty-string.rs fix string and tuple struct formatting 2025-02-12 01:30:09 -06:00
enum-thinlto.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
evec-in-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
extern-c-fn.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
f16-natvis.rs Add Natvis visualiser and debuginfo tests for f16 2024-07-09 03:47:50 +01:00
fixed-sized-array.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
fn_ptr.rs Add and improve debuginfo tests for Windows 2025-01-13 09:38:04 +01:00
function-arg-initialization.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
function-arguments.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
function-call.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
function-names.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
function-prologue-stepping-regular.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
gdb-char.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
gdb-pretty-struct-and-enums.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
generic-enum-with-different-disr-sizes.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-function.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-functions-nested.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-method-on-generic-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-static-method-on-struct-and-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-struct-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
generic-tuple-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
include_string.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
issue-7712.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-12886.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
issue-13213.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-14411.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
issue-22656.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
issue-57822.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-for-loop.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-if-let.rs Add and improve debuginfo tests for Windows 2025-01-13 09:38:04 +01:00
lexical-scope-in-if.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-match.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-parameterless-closure.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
lexical-scope-in-stack-closure.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-unconditional-loop.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-unique-closure.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-in-while.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scope-with-macro.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
lexical-scopes-in-block-expression.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
limited-debuginfo.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
macro-stepping.inc Move /src/test to /tests 2023-01-11 09:32:08 +00:00
macro-stepping.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
marker-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
method-on-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
method-on-generic-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
method-on-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
method-on-trait.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
method-on-tuple-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
msvc-pretty-enums.rs Stabilise repr128 2025-05-28 15:14:34 +01:00
msvc-scalarpair-params.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
multi-byte-chars.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
multi-cgu.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
multiline-calls.rs Use the fn_span when emitting function calls for better debug info. 2025-05-22 14:06:24 -07:00
multiple-functions-equal-var-names.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
multiple-functions.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
mutable-locs.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
mutex.rs Move some things to std::sync::poison and reexport them in std::sync 2025-01-02 15:21:41 +03:00
name-shadowing-and-scope-nesting.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
no_mangle-info.rs Fix remaining LLDB commands. 2024-03-15 20:30:45 +01:00
numeric-types.rs Mark numeric-types.rs as 64-bit only for now 2024-11-17 04:16:59 +08:00
option-like-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
packed-struct-with-destructor.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
packed-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
path.rs Add rust-lldb pretty printing for Path and PathBuf 2024-03-29 18:02:26 -06:00
pretty-huge-vec.rs Fix test hangs on AIX 2025-03-04 10:06:28 -05:00
pretty-slices.rs Replace gdbr with gdbg 2024-08-18 12:39:07 -04:00
pretty-std-collections-hash.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
pretty-std-collections.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
pretty-std.rs fix string and tuple struct formatting 2025-02-12 01:30:09 -06:00
pretty-uninitialized-vec.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
range-types.rs Update cdb annotations for range-types.rs with cdb 10.0.26100.2161 2024-11-17 00:42:30 +08:00
rc_arc.rs Delete redundant gdb-version requirements and related comments 2024-08-18 16:58:25 -04:00
recursive-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
recursive-struct.rs fix(debuginfo): handle false positives in overflow check 2025-08-12 17:13:13 +08:00
recursive-type-with-gat.rs tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
reference-debuginfo.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
regression-bad-location-list-67992.rs Convert lldbg- to lldb- 2024-08-18 17:00:33 -04:00
result-types.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
rwlock-read.rs Move some things to std::sync::poison and reexport them in std::sync 2025-01-02 15:21:41 +03:00
rwlock-write.rs Move some things to std::sync::poison and reexport them in std::sync 2025-01-02 15:21:41 +03:00
self-in-default-method.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
self-in-generic-default-method.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
shadowed-argument.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
shadowed-variable.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
should-fail.rs Delete min-lldb-version: 310 2024-08-18 16:58:26 -04:00
simd.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
simple-lexical-scope.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
simple-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
simple-tuple.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
skip_second_statement.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
skip_second_statement_collapse.rs debuginfo: Stabilize -Z debug-macros, -Z collapse-macro-debuginfo and #[collapse_debuginfo] 2024-04-25 22:14:47 +03:00
static-method-on-struct-and-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
step-into-match.rs [win][arm64] Disable various DebugInfo tests that don't work on Arm64 Windows 2025-05-07 10:49:54 -07:00
strings-and-strs.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
struct-in-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
struct-in-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
struct-namespace.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
struct-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
struct-with-destructor.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
text-to-include-1.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
text-to-include-2.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
text-to-include-3.txt Move /src/test to /tests 2023-01-11 09:32:08 +00:00
thread-names.rs Enable more debuginfo tests on Windows 2024-08-16 21:14:45 -04:00
thread.rs Revert "Remove the Arc rt::init allocation for thread info" 2025-01-14 13:37:25 +01:00
trait-pointers.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
tuple-in-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
tuple-in-tuple.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
tuple-struct.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
tuple-style-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
type-names.cdb.js Move /src/test to /tests 2023-01-11 09:32:08 +00:00
type-names.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
union-smoke.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
unique-enum.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
unit-type.rs Update cdb annotations for unit-type.rs with cdb 10.0.26100.2161 2024-11-17 00:50:54 +08:00
unreachable-locals.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
unsized.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
var-captured-in-nested-closure.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
var-captured-in-sendable-closure.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
var-captured-in-stack-closure.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
vec-slices.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
vec.rs Remove the omit_gdb_pretty_printer_section attribute 2025-08-01 20:04:59 +00:00
zst-interferes-with-prologue.rs Don't leave debug locations for constants sitting on the builder indefinitely. 2024-09-06 23:12:18 +00:00