rust-lang / rust-lang/rust

LLDB `v --ptr-depth 1` can't dereference pointer to a struct

Open
#147,450 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuggers A-debuggers-lldb C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

struct S(i32);

fn main() {
    let s = &S(1);
    println!("Hello, world!");
}

When using LLDB with nightly Rust's pretty printers, I expect v --ptr-depth 1 to dereference the pointer to the struct and display its contents:

Process stopped
* thread #1, name = 'pp', stop reason = step over
    frame #0: 0x0000555555568bd0 pp`pp::main::hf3117127974a188e at main.rs:5:5
   2   	
   3   	fn main() {
   4   	   let s = &S(1);
-> 5   	   println!("Hello, world!");
   6   	}
(lldb) v --ptr-depth 1
(pp::S *) s = 0x0000555555559a84 {
  __0 = 1
}

Instead, it only prints the pointer address:

Process stopped
* thread #1, name = 'pp', stop reason = step over
    frame #0: 0x0000555555568bd0 pp`pp::main::hf3117127974a188e at main.rs:5:5
   2   	
   3   	fn main() {
   4   	   let s = &S(1);
-> 5   	   println!("Hello, world!");
   6   	}
(lldb) v --ptr-depth 1
(pp::S *) s = 0x0000555555559a84

This regressed in https://github.com/rust-lang/rust/commit/c39ebeaa0b780afbeb40c8a42cc20bea861ca458

Meta

rustc --version --verbose:

rustc 1.92.0-nightly (3d8c1c1fc 2025-10-06)

lldb --version:

lldb version 20.1.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Rust snippet and LLDB command shown, then inspect the regression introduced by commit c39ebeaa0b780afbeb40c8a42cc20bea861ca458. The fix is complete when v --ptr-depth 1 displays the pointed-to struct contents, including __0 = 1, rather than only its address.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.